Using Node.js, I'm evaluating the expression:
0 < Number.MIN_VALUE
To my surprise, this returns true
. Why is that? And: How can I get the smallest number available for which the comparison works as expected?
Number. MIN_VALUE is the smallest positive number (not the most negative number) that can be represented within float precision — in other words, the number closest to 0.
JavaScript Number MIN_VALUE MIN_VALUE returns the smallest number possible in JavaScript. Number. MIN_VALUE has a value of 5e-324.
Number. MIN_VALUE is 5e-324 , i.e. the smallest positive number that can be represented within float precision, i.e. that's as close as you can get to zero. It defines the best resolution floats give you. Now the overall smallest value is Number.
JavaScript Number MAX_VALUE MAX_VALUE returns the largest number possible in JavaScript. Number. MAX_VALUE has the value of 1.7976931348623157e+308.
Number.MIN_VALUE
is 5e-324
, i.e. the smallest positive number that can be represented within float precision, i.e. that's as close as you can get to zero. It defines the best resolution floats give you.
Now the overall smallest value is Number.NEGATIVE_INFINITY
although that's not really numeric in the strict sense.
Number.MIN_VALUE
is equivalent to 5e-324 , which is greater than 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With