4 ms·
Anyone who's ever worked on programming language implementation will recognise that you will for all time get a steady stream of occasional bug reports that you
by chrisseaton 6y ago
Anyone who's ever worked on programming language implementation will recognise that you will for all time get a steady stream of occasional bug reports that your floating point numbers aren't arbitrarily precise.
Some language implementation bug trackers have a warning not to submit bugs for it front and centre because they get it so often.
- saagarjha 6y agoIn JavaScript I assume it’s worse because most people would assume the existence of some sort of integer type but the number silently “becomes a floating point” instead, which can be confusing.
- Gibbon1 6y agoI don't use JavaScript but JavaScript using binary floating point always makes me shake my head in disbelief. You got a language designed from the start to deal with user input that can't represent decimal numbers and fractions.
- SAI_Peregrinus 6y agoJSON Numbers are arbitrary precision floating point. JavaScript numbers aren't necessarily numeric, they can be NaN or INF. That disconnect isn't a bug, but can cause problems if you naively convert from one to the other without handling the edge cases.
- Spivak 6y agoThe problem is we’re now at the point where we have mountains of code that doesn’t handle the edge cases and very little that can be done outside of being super conservative about what send an unknown JSON parser.