next up previous contents
Next: Overflow Up: Arithmetic Exceptions Previous: Arithmetic Exceptions   Contents

Division by 0

If is a floating point number, then IEEE standard requires that

If or the definitions make mathematical sense. Recall that have special binary representations, with all exponent bits equal to 1 and all mantissa bits equal to 0.

If , then the operation is , which makes no mathematical sense. What we obtain is therefore invalid information. The result is the ``Not a Number'', in short NaN. Recall that NaN also have a special binary representation. NaN is a red flag, which tells the user that something wrong happened with the program. may or may not be the result of a bug, depending on the context.

Adrian Sandu 2001-08-26