A quick and dirty test on Mac/Safari shows that the output of "Hello World! " + 3.1415926535E-20 + " " + 123456789 is not sensitive to the system locale setting. The numerical output uses a '.' and a lower-case 'e'.
Dan On Tue, Nov 17, 2009 at 8:09 PM, Daniel Rice (דניאל רייס) <r...@google.com>wrote: > My thinking is that unless we provide an implementation of > Double.toString, we are best off trying to be consistent with the > implementation at hand. If we use Double.toString (i.e., just Javascript > native double-to-string conversion) some of the time, and use arithmetic ops > to extract fractional digits some of the time, we will always see corner > cases where things don't match. If we use Double.toString and extract > digits from that, at least the answers form a consistent set. > > I take your point that we can't rely on the specific characters '.' and > 'E'. Perhaps we can add some code to infer the right characters (caching > them after they have been determined), or validate some heuristic such as > 'digit=[0-9], exponential separator=[A-Za-z], decimal point=[anything > else]'. > > Dan > > > On Tue, Nov 17, 2009 at 5:14 PM, <j...@google.com> wrote: > >> There is a big overriding issue I am concerned about. I have not gone >> over all the logic until that is answered, but overall I am not sure >> this is better than improving the current approach. >> >> >> http://gwt-code-reviews.appspot.com/97812/diff/1/2 >> File user/src/com/google/gwt/i18n/client/NumberFormat.java (right): >> >> http://gwt-code-reviews.appspot.com/97812/diff/1/2#newcode1323 >> Line 1323: String digits = Double.toString(number); >> This essentially reduces to "" + number in JS -- how certain are we that >> the result is sufficiently predictable across all browsers and locales >> that we can get the correct result. For example, what happens in >> locales that use different decimal/comma separators, or something >> besides E for exponential notation? >> >> I am very leery of relying on this behavior. >> >> >> http://gwt-code-reviews.appspot.com/97812 >> > > -- http://groups.google.com/group/Google-Web-Toolkit-Contributors