A numerical problem of js, can anyone help explain it?

the last three digits of my stored value are 102
, and the final deposit is 104

.

what is the problem of js? solve

Mar.30,2021

take a look at this article, the calculation of too long numbers in js is not accurate.
https://codeshelper.com/a/11.


the first feeling is a loss of precision.


js https://www.cnblogs.com/xingg. reference


after your number exceeds Number.MAX_SAFE_INTEGER, and exceeds this number, js cannot guarantee precision. For example, you can see:

clipboard.png

Menu