Reputation: 14662
When i assign 99999999999.999999
to a variable, it gets round off to 100000000000,
and when i remove one 9
from the value , the last digit becomes 8.
like,
9999999999.999999 = 9999999999.999998
99999999999.99999 = 99999999999.99998
kindly help me to resolve this
Upvotes: 3
Views: 609
Reputation: 13994
Numbers in ECMAScript (Javascript) are internally represented by double-precision floating-point. When setting a number, it actually is assigned the nearest representable double-precision value, which is 100000000000 in this case.
See Large numbers erroneously rounded in Javascript
Upvotes: 2