math - In JavaScript, why ( Number.MAX_VALUE - 1) < Number.MAX_VALUE always evaluate to false? -
in javascript
, number.max_value represents maximum representable numeric value (which approximately 1.79e+308
, pretty big number)
however, if evaluate (number.max_value - 1) < number.max_value
in javascript console, returns me false
.
if use multiplication, works thought :
(number.max_value * 0.99999) < number.max_value
returns true
maybe missing something, possible explanation ?
the reason although allowable number range very large, precision of js number (ieee 754 double precision) insufficient represent every possible number in range. doing require 308 digits!
hence max_value - 1
indistinguishable max_number
.
Comments
Post a Comment