[Webkit-unassigned] [Bug 48221] Number values should be in the range of IEEE 754 single-precision floating point number

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 25 22:58:27 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=48221





--- Comment #6 from Dai Mikurube <dmikurube at google.com>  2010-10-25 22:58:27 PST ---
(In reply to comment #5)
I'm investigating the serialization. Fixing it seems to be complicated and may have large effects. (Because of (*1))

My idea here is to file another bug for it. Such serializations (like 5.015000000000001) is not caused by this patch. The current version without this patch shows the same serialization, too. What do you think on it?



(*1)
I found few ways to limit the precision in converting double to string.
- No extra parameters for the precision in numberToString (JavaScriptCore/wtf/dtoa.cpp).
- numberToString uses DecimalNumber (.../wtf/DecimalNumber.h) which doesn't accept a parameter for precisions.
- DecimalNumber calls dtoa (.../wtf/dtoa.cpp) which decides the precision only with the double value.

My idea of changing is :
- to add another overloaded numberToString with specifying the precision, and
- to add another constructor of DecimalNumber with specifying the precision
But it should be a kind of large patch and may have large effects to the JavaScript core. Another nice idea is, of course, welcome. But I think it should be done in another bug.



In addition, another difficulty from the specification.

- Double values should be serialized with the same way as JavaScript ToString. ("The best representation of the number n as a floating point number is the string obtained from applying the JavaScript operator ToString to n." [http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#real-numbers]

- The floating point number in JavaScript is in IEEE 754 double-precision.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list