top | item 42033800

(no title)

jepler | 1 year ago

You don't need machine code these days to find overflow in IEEE floating point arithmetic.

If any intermediate sum overflows, you get an infinity. Further arithmetic can never return you to the realm of finite numbers (though you can also get into the world of "not a number" NaNs by calculating -inf + inf for instance), so you can use a standard function like (C99 <math.h>) isfinite() to check if any intermediate step of summing FP numbers overflowed the representation.

discuss

order

No comments yet.