javascript浮点运算问题

在判断浮点运算结果前对计算结果进行精度缩小,因为在精度缩小的过程总会自动四舍五入;

(1.0-0.9).toFixed(digits)     toFixed() 精度参数须在 0 与20 之间

如   (1.0-0.9).toFixed(10)==0.1  ,结果为True 

原文地址:https://www.cnblogs.com/jameshappy/p/2116972.html