I have some inputs on my site that represent floating point numbers containing up to ten precision digits (in decimal). At some point, in the client-side verification code, I need to compare a pair of these values ββto make sure they are equal or not, and here, as you would expect, the internals of IEEE754 make this simple check unsuccessful with such things (2.0000000000 = = 2.0000000001) = true.
I can break the floating point number into two long points for each side of the point, make each side 64-bit long and do my comparisons manually, but it looks so ugly!
Any decent Javascript library for handling arbitrary (or at least guaranteed) precision floating point numbers in Javascript?
Thanks in advance!
PS: GWT-based solution has ++
javascript floating-point gwt
opsidao Jan 21 '10 at 11:18 2010-01-21 11:18
source share