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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -