Revisiting Decimal

Kris Zyp kris at
Thu Jan 15 10:46:04 PST 2009

Hash: SHA1

Brendan Eich wrote:
> On Jan 15, 2009, at 9:47 AM, Kris Zyp wrote:
>> Where is the loss coming from?
> Decimal-using peer S1 encodes
> {p:1.1, q:2.2}
> Double-using peer C1 decodes, adds, and returns
> {p:1.1, q:2.2, r:3.3000000000000003}
> The sender then checks the result using decimal and finds an error.
>  Meanwhile the same exchange between S1 and decimal-using peer C2
> succeeds without error.
> /be
Exactly, C1 introduces the error by it's use of binary. The JSON
encoding didn't introduce the error. JSON exactly represented the data
it was given, and the decimal decoding and encoding peer refrains from
introducing errors as well.

Are you arguing that all JSON interaction relies on other peers
introduces errors according to binary floating computations? I already
disproved that idea by pointing out there are existing implementations
that use decimal and thus don't add such errors. If you are arguing
that there are certain client-server couples have become dependent on
these errors there are couple faults in this logic. First, the error
dependencies experienced in languages are almost always going to be
internalized by devs. Because there may be a number of internal error
expectations in existence does not imply a significant number of
inter-machine rounding error expectation dependency. Second, I am not
asserting that JSON decoding should automatically convert JSON numbers
to binary, only that JSON encoding should serialize decimals to
numbers. In your example, if a server is sending these JSON values to
C1 ES-harmony based peer for computation, the computations will still
take place in binary, unless we were to add some mechanism for
explicitly specifying how numbers should be decoded.

JSON does not follow the path of other formats that attempt to dictate
tight language-type couplings. In all cases, peers can ultimately
choose how they want to internally handle the data provided by JSON.
JSON is pure data format, not computation prescription and won't
dictate how computations are performed.


- --
Kris Zyp
(503) 806-1841
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -

More information about the Es-discuss mailing list