3 ms·
You think an instruction with Javascript in the name, that converts JavaScript floating-point to signed fixed-point, rounding towards zero, isn't used when pars
by cbsmith 6y ago
You think an instruction with Javascript in the name, that converts JavaScript floating-point to signed fixed-point, rounding towards zero, isn't used when parsing JSON?
- SAI_Peregrinus 6y agoIt is, but oddly enough Javascript numbers and JSON numbers are different and mutually incompatible. JS allows ±INF and the NANs, since it uses IEEE754 double-precision floating point. JSON doesn't, and technically allows arbitrary precision floating point (though implementations are allowed to define truncation behavior to a format at least as large as an IEEE754 double).
- dragonwriter 6y ago> and technically allows arbitrary precision floating point technically, "arbitrary precision decimal"; floating point is a storage representation, to which JSON is formally agnostic, though RFC 8259 recommends that limiting to the range and precision representable with IEEE 754 doubles is a good idea for interoperability.
- cbsmith 6y agoYup. One of many ways that parsing JSON is anything but a simple thing is the ambiguity around how numbers, which really isn't a hard thing to get right.