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

  

posted @ 2019-01-15 17:55  alexandra  阅读(275)  评论(0编辑  收藏  举报