开发者

Javascript parseInt with radix 16 issue

开发者 https://www.devze.com 2023-01-11 03:17 出处:网络
The alert statementalert(parseInt(\"0x00C02700010004E9\",16)); incorrectly displays 54086076498707690 instead of the correct value 54086076498707689. Please notice t开发者_JAVA百科he last two digits!!

The alert statement alert(parseInt("0x00C02700010004E9",16)); incorrectly displays 54086076498707690 instead of the correct value 54086076498707689. Please notice t开发者_JAVA百科he last two digits!!

Could anyone shed some light on what am I doing wrong?


Yes! Javascript is not accurate to that many digits! See: Large numbers erroneously rounded in Javascript

0

精彩评论

暂无评论...
验证码 换一张
取 消