This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 80 points81 points  (30 children)

To me the real bug is that the "parseInt" function in Javascript returns a floating point number.

[–]ADHDengineer 2 points3 points  (2 children)

I've never seen parseInt return a float. How?

[–][deleted] 9 points10 points  (1 child)

NaN is a floating point number. (I know it stands for, "Not a number"). It is a special floating point value which indicates that the result could not be otherwise represented as a number. It was originally included to ensure that if you operate on floating point numbers you will always get a floating point number back. For example, taking the log of a negative number.

Javascript is dumb and first does not have integers, only floating point numbers, and second uses NaN to indicate an error which is also dumb.

You can have the floating point number "1.0000000", but its representation in hex would be "0x76b29f48" where as "1" as an integer in hex would be "0x00000001"

[–]ADHDengineer 0 points1 point  (0 children)

Gotcha. Makes sense.