3 ms·
(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).
by stephencanon 14y ago
(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.
- Roboprog 14y agoWell, 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)