News for hackers. Stuff that matters.
Re:How to Handle Monetary Values in JavaScript by recursive on Tuesday October 30, 2018 @03:50PM (#18340672)
Your details are off. 1.0 is precisely representable in double precision floating point with no error.
Re:How to Handle Monetary Values in JavaScript by maxxxxx on Tuesday October 30, 2018 @03:58PM (#18340760)
Sorry, picked the wrong number. But I think the general idea is correct.
Re:How to Handle Monetary Values in JavaScript by nestorD on Tuesday October 30, 2018 @07:05PM (#18341988)
I am pretty sure you were thinking of 0.1 which, indeed, requires an infinite number of digits to be represented in binary (like 1/3 in decimal).
Re:How to Handle Monetary Values in JavaScript by maxxxxx on Tuesday October 30, 2018 @10:33PM (#18342930)
Probably. I just remember that this tripped me up big time a long time ago.