Hacker News new | past | comments | ask | show | jobs | submit login

(1) NaN is not an error code. It is a value added to the system to make it closed under all the usual operations (thus eliminating the need for error codes).

(2) Adding values of varying magnitude does not produce NaN results in IEEE-754 arithmetic. The only addition that produces a NaN is +Infinity + -Infinity, which have equal magnitude.




Well, drat. I was under the impression from comments elsewhere in this thread that part of the (a?) standard was to track overflow/underflow.

Go with what I know, then: add the small numbers first (sort the addends in increasing absolute magnitude)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: