Why does JavaScript returns that?

Viewed 59

So, my question is why:

1.7976931348623157E+308 > 10^16 returns 17 in Google Chrome,
and (1.7976931348623157E+308) > (10^16) returns true?

Because it looks like these operations are the same.

1 Answers

The first expression is equivalent to

(1.7976931348623157E+308 > 10) ^ 16

or

true ^ 16

Which seems strange, until you realize that

true == 1

is true.

Related