84669 人が学習中
152542 人が学習中
20005 人が学習中
5487 人が学習中
7821 人が学習中
359900 人が学習中
3350 人が学習中
180660 人が学習中
48569 人が学習中
18603 人が学習中
40936 人が学習中
1549 人が学習中
1183 人が学習中
32909 人が学習中
jsではNumber.MAX_VALUEが表現できる最大値を表します。この値を超えると無限大と表示されますが、以下の計算がわかりにくいです
これがなぜなのか誰が理解できますか?説明してもらえますか?
因为 123 太小,不足以改变高位数表达
因为 Number.MAX_VALUE 够大,足以改变高位数表达
5.3e-324 的 .3 过小
总结: js 在很多时候会难以保证浮点数计算精度,如 0.1 + 0.2 != 0.3 // true
一个亿加1,四舍五入之后还是一个亿,差不多一个道理。到不了那么精确的
应该只是一种数值的表示吧,如果减号与数字隔开是无法计算的
In the first example, you just increase your number by a really tiny number: 123 according to 1.79^308 is nothing. So you "lost" some precision: it does not change the number. In the second one, you exceed the max value, so your number is not a number anymore, it is Infinity.
In the first example, you just increase your number by a really tiny number: 123 according to 1.79^308 is nothing. So you "lost" some precision: it does not change the number.
In the second one, you exceed the max value, so your number is not a number anymore, it is Infinity.
by Mistalis from stackoverflowsomething about Number.MAX_VALUE
因为 123 太小,不足以改变高位数表达
因为 Number.MAX_VALUE 够大,足以改变高位数表达
5.3e-324 的 .3 过小
总结: js 在很多时候会难以保证浮点数计算精度,如 0.1 + 0.2 != 0.3 // true
![](http://img.php.cn/upload/image/000/000/000/8ce733f1306819b0fb33bd37bf813836-0.png)
一个亿加1,四舍五入之后还是一个亿,差不多一个道理。到不了那么精确的
应该只是一种数值的表示吧,如果减号与数字隔开是无法计算的
by Mistalis from stackoverflow
something about Number.MAX_VALUE
说白了就是浮点数精度问题!