On Thu, Apr 16, 2009 at 12:35, Thibaut Barrère <thibaut.barr...@gmail.com> wrote:
> I ran the whole irtests suite after applying the attached patch, based > on what Daniel described. You can find a slightly modified patch attached to this mail, this is what I'm going to push on my repository. I think this one is better than the first one as it removes the overhead of Convert.ToString and it reduces the number of unboxing operations from object to double. -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN
diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs index 6da6a3d..0d18961 100644 --- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs +++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs @@ -621,22 +621,23 @@ namespace IronRuby.Builtins { if ((list = obj as List<object>) != null) { return IListOps.Join(tosConversion, list, NewLine); } else if ((hash = obj as IDictionary<object, object>) != null) { return IDictionaryOps.ToMutableString(tosConversion, hash); } else if (obj == null) { return MutableString.Create("nil"); } else if (obj is bool) { return MutableString.Create((bool)obj ? "true" : "false"); } else if (obj is double) { - var result = MutableString.Create(obj.ToString()); - if ((double)(int)(double)obj == (double)obj) { + double value = (double)obj; + var result = MutableString.Create(value.ToString(System.Globalization.CultureInfo.InvariantCulture)); + if ((double)(int)value == value) { result.Append(".0"); } return result; } else if ((str = obj as MutableString) != null) { return str; } else { return Protocols.ConvertToString(tosConversion, obj); } }
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core