Floating point operation precision lost js

it is found that there is a bit of pit in js, and the precision of large floating point number operation will be lost, and the calculation result is not accurate

.

is there any way to solve this problem

Feb.20,2022

one of the characteristics of the JS language.
look at my screenshot of this thing, not to mention your calculation. It is best not to calculate floating point numbers at the front end, especially those involving the amount of money.

clipboard.png

for a more complete solution, you need to install a 1k package: https://github.com/nefe/numbe.

.

popular science learning articles ="

Menu