New issue
Advanced search Search tips

Issue 916517 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Dec 19
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Long values in json are rounded

Reported by sylvain....@gmail.com, Dec 19

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

Steps to reproduce the problem:
1. Call a Web service returning a JSON with a field containing a long value : 3412318551606316990
2. Display the result as "RAW"
{...,"sessionId":3412318551606316996,...}

3. Display the value as "Parsed"
{...,"sessionId":3412318551606317000,...}

4. The result is the same when used in JavaScript

What is the expected behavior?
Value must not be rounded to 3412318551606317000 and must be equals to 3412318551606316996

What went wrong?
The value is rounded and no longer corresponds to the expected value.
As in my use case value is a toklen identifier, my session could not be authenticated.

Did this work before? N/A 

Chrome version: 71.0.3578.98  Channel: stable
OS Version: 10.0
Flash Version: 

Don't know if it was working before as I was using smaller values like 3412318551606316.
 
This is working as per JavaScript/JSON specification which defines numbers in IEEE 754 double precision format:
https://www.ecma-international.org/ecma-262/9.0/index.html#sec-terms-and-definitions-number-value
https://tools.ietf.org/html/rfc7159#section-6

which means it can store only 15-17 digits of a number reliably:
https://en.wikipedia.org/wiki/Double-precision_floating-point_format#IEEE_754_double-precision_binary_floating-point_format:_binary64

Your numbers have 19 digits so you need to store them as strings.
Cc: bokan@chromium.org
Status: WontFix (was: Unconfirmed)
Thanks woxxom@ for the explanation. Marking as wont fix due to #1.

Sign in to add a comment