4 ms·
Integers don't exist in JS/JSON... You get IEEE754 double precision floating point numbers, meaning whole numbers between -(2^53 - 1) through (2^53-1) are suppo
by tracker1 11y ago
Integers don't exist in JS/JSON... You get IEEE754 double precision floating point numbers, meaning whole numbers between -(2^53 - 1) through (2^53-1) are supported without rounding issues.
If you need greater precision or fixed decimals, use a base10 string and an appropriate library in your application.
I'd say the lack of strict date/locations in the spec are probably as big of an issue, but there are standards for how to handle that that have evolved as well... (geojson and ISO-8601 date-time strings).
- rwmj 11y agoYou've made my point with "If you need greater precision or fixed decimals, use a base10 string and an appropriate library in your application". In other words, it's not interoperable or type safe. BTW the JSON spec itself doesn't define integers at all. "Numbers are really floats" comes from Javascript and hence is just a convention for people who are using JSON from another language. The larger problem is the lack of schemas. In JSON they exist but no one uses them. CORBA forced you to have a schema (IDL). SOAP had schemas, albeit very complex ones which no one really understood.
- tracker1 11y ago"JavaScript Object Notation" ... it makes perfect sense for JSON numbers to match JS numbers, which is IEEE spec.