|
|
|
|
|
by dbaupp
3017 days ago
|
|
That problem is normal and expected behaviour for finite precision floating point: it appears with any scheme for floating point (IEEE-754 or not), as computers are finite. A significant chunk of the field of numerical analysis is about controlling the error introduced by floating point. And, anyway, R uses IEEE-754 for 'numeric' too[0], and will do the same "fudging": > All R platforms are required to work with values conforming to the IEC 60559 (also known as IEEE 754) standard There's fair criticisms that JS may not offer the required control over rounding modes that R (or the C libs underlying R) provide or the necessary instructions to minimise error accumulation, but general handwavings about "fudging" of floating point don't apply: floating point is unavoidably imprecise, and R and JS even use the same basic format. [0]: https://stat.ethz.ch/R-manual/R-devel/library/base/html/doub... |
|
Handwaving is all I can do, I am just the tech taking orders.
I just talked with my statistician friend on the phone, here's one issue my friend just showed me. (integer error, not even floating point)
111,111,111 * 111,111,111 = 12,345,678,987,654,321
(I did this by hand to confirm, he made me the big meany)
Excel, Libre Office, my calculator, Javascript, etc.. all get this number wrong. But with R there's a library that can add support for numbers this big. (I guess this is a well known issue)
Edit: _All_ numbers in JS are floating point numbers, there are no integers... <hmmm>
"In JavaScript, all numbers are implemented in double-precision [...] There is no specific type for integers."
Edit 2: (for fun) This is from R:
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...