when data value it too long , the number will be changed.
when data value it too long , the number will be changed.
hager
Posts: 1Questions: 1Answers: 0
When the number is 9194237220629948492, the page display becomes 9194237220629948000 , and the precision is lost.
This discussion has been closed.
Answers
Javascript uses 64-bit Floating Point numbers. Your number is likely beyond that range. Here is an interesting SO thread:
https://stackoverflow.com/questions/307179/what-is-javascripts-highest-integer-value-that-a-number-can-go-to-without-losin
Kevin
If you must use numbers outside the range that can be handled natively by Javascript google around for BigDecimal, there are quite a few implementations.
Another option, if you aren't actually performing any numerical calculations is to simply have it as a string in your JSON data.
Allan