JSON numbers (was: Revisiting Decimal)

Sam Ruby rubys at intertwingly.net
Thu Jan 15 19:28:07 PST 2009


On Thu, Jan 15, 2009 at 9:24 PM, Brendan Eich <brendan at mozilla.com> wrote:
>
> JSON's intended semantics may be arbitrary precision decimal (the RFC is
> neither explicit nor specific enough in my opinion; it mentions only
> "range", not "precision"), but not all real-world JSON codecs use arbitrary
> precision decimal, and in particular today's JS codecs use IEEE double
> binary floating point. This "approximates" by default and creates a de-facto
> standard that can't be compatibly extended without opt-in.

You might find the next link enlightening or perhaps even a pleasant diversion:

http://www.intertwingly.net/stories/2002/02/01/toInfinityAndBeyondTheQuestForSoapInteroperability.html

Quick summary as it applies to this discussion: perfection is
unattainable (duh!) and an implementation which implements JSON
numbers as quad decimal will retain more precision than one that
implements JSON numbers as double binary (duh!).

- Sam Ruby


More information about the Es-discuss mailing list