6 ms·
I once heard a joke about a team in an unnamed bank that was interfacing with the mainframe using the latest and greatest JavaScript framework of the time. Once
by lowry 8y ago
I once heard a joke about a team in an unnamed bank that was interfacing with the mainframe using the latest and greatest JavaScript framework of the time. Once they were full speed in production, bug reports started to pop up. They tried solving them one by one until some brave soul reminded them that JavaScript has only one way to represent numbers and it happens that the JavaScript way is totally unfit for monetary calculations.
P.S. As much as I hate DEC64, it is a much better way to handle money. Someone please add DEC64 to JavaScript! We have Set and generator functions. Why not another way to store floating point numbers!
- ricardobeat 8y agoYou can easily store arbitrary precision numbers in an ArrayBuffer, there are several arbitrary-precision libraries for JS, for example http://crunch.js.org http://crunch.js.org I'm sure you're aware, but it should be mentioned that all languages using single-precision FP by default behave the same. Ruby, Python, Perl, PHP (or any other if you use float instead of double).
- fbonetti 8y agoRuby has distinct integer and float classes (Fixnum/Bignum and Float, respectively).