On 2018-05-06 21:37, Mark Miller wrote:

> I take that back. The rfc says:

>

> An I-JSON sender cannot expect a receiver to treat an integer whose

> absolute value is greater than 9007199254740991 (i.e., that is

> outside the range [-(2**53)+1, (2**53)-1]) as an exact value.

>

> For the natural interpretation of "treat" as in "operate on or with" I'd say the rfc is correct. But the language is ambiguous and should be clarified.

Well, the author questioned that IEEE-754 implementations actually deal with this edge case at all.

However, they do which I found out by testing with 9007199254740992 in order to break my canonicalizer implementations which to my surprise all continued to work.

Then, when looking at the binary, it became clear that Number.MAX_SAFE_INTEGER is not comparable to other languages' MAX* definitions.

https://docs.oracle.com/javase/8/docs/api/constant-values.html#java.lang.Integer.MAX_VALUEAnyway, thanx for the insights in this matter!

Anders

>

>

>

>

> On Sun, May 6, 2018 at 12:34 PM, Mark Miller <

[hidden email] <mailto:

[hidden email]>> wrote:

>

> Hi Anders, you are correct. The rfc as stated is incorrect. The EcmaScript spec is correct.

>

> 2**53 is indeed exactly representable, which is what the rfc is about. But 2**53 is not safe, which what the ecmascript spec is about.

>

>

>

> On Sun, May 6, 2018 at 11:58 AM, Anders Rundgren <

[hidden email] <mailto:

[hidden email]>> wrote:

>

> On 2018-05-06 19:57, Logan Smyth wrote:

> <snip>

>

> I think the best source of truth is likely the spec:

https://www.ecma-international.org/ecma-262/8.0/#sec-number.max_safe_integer <

https://www.ecma-international.org/ecma-262/8.0/#sec-number.max_safe_integer> which states

>

> The value of Number.MAX_SAFE_INTEGER is the largest integer n such that n and n + 1 are both exactly representable as a Number value.

>

>

> Right, this is essentially what I'm claiming; Number.MAX_SAFE_INTEGER + 1 is a valid (exact) integer which means that

https://tools.ietf.org/html/rfc7493#section-2.2 <

https://tools.ietf.org/html/rfc7493#section-2.2> is incorrect.

>

> Anders

> _______________________________________________

> es-discuss mailing list

>

[hidden email] <mailto:

[hidden email]>

>

https://mail.mozilla.org/listinfo/es-discuss <

https://mail.mozilla.org/listinfo/es-discuss>

>

>

>

>

> --

> Cheers,

> --MarkM

>

>

>

>

> --

> Cheers,

> --MarkM

_______________________________________________

es-discuss mailing list

[hidden email]
https://mail.mozilla.org/listinfo/es-discuss