JSON reader not able to display max and min values of signed 64 bit integers
Categories
(DevTools :: JSON Viewer, defect)
Tracking
(Not tracked)
People
(Reporter: hsinmao, Unassigned)
Details
User Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1
Steps to reproduce:
I was reading a JSON from within the browser, the values were supposed to be Long.MAX_VALUE and MIN_VALUE. I thought I found a bug in my own code however after comparing the raw data to the JSON formatted views in Firefox 81, I saw that -9223372036854775807 and 9223372036854775808 in the raw data view were being displayed as +/-9223372036854776000 respectively in the JSON view.
Actual results:
I almost had a panic attack thinking I had shipped broken code to prod.
Expected results:
The JSON viewer should be displaying 64bit signed integers correctly.
Comment 1•5 years ago
|
||
JSON viewer parses the input JSON file with ECMAScript function JSON.parse,
in ECMAScript, numbers are double-precision 64-bit binary format IEEE 754-2019 value,
and it cannot represent 64-bit signed integer max value.
https://tc39.es/ecma262/#sec-terms-and-definitions-number-value
Updated•5 years ago
|
Description
•