js計算精度問題(浮點數偏差,大數計算出錯)

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

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
相關文章
相關標籤/搜索