Computers store numbers in binary, and the way to convert a decimal to binary is to multiply the decimal part by 2, which leads to an inexact representation of the decimal part, so when you add two decimals, it’s very likely to cause errors

The solution is to convert numbers to integers add them up and divide by their magnification or use a third-party libraryCopy the code

Reference link: juejin.cn/post/684490…