If you’ve ever been surprised by a program that printed some cryptic letter combination when you were expecting a number, you’ve run into an arithmetic exception. This article explains what caused your problem and what you may be able to do to fix it.
IEEE floating-point exceptions
Here’s a teaser. If x
is of type float
or double
, does the expression (x == x)
always evaluate to true? Are you certain?