js计算精度问题(浮点数误差,大数计算出错)

https://github.com/camsong/blog/issues/9

0.1+0.2   //0.30000000000000004
1-0.9     //0.09999999999999998
9007199254740993-9007199254740992  //0
Math.pow(2,1023) //8.98846567431158e+307   
//但是
Math.pow(2,1024)  //Infinity

  

猜你喜欢

转载自www.cnblogs.com/alexandra/p/10273345.html