Datasheet

Floating-point Support
5-36 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
Types of exception
The ARM floating-point environment recognizes five different types of exception:
The Invalid Operation exception happens when there is no sensible result for an
operation. This can happen for any of the following reasons:
performing any operation on a signalling NaN, except the simplest
operations (copying and changing the sign)
adding plus infinity to minus infinity, or subtracting an infinity from itself
multiplying infinity by zero
dividing 0 by 0, or dividing infinity by infinity
taking the remainder from dividing anything by 0, or infinity by anything
taking the square root of a negative number (not including minus zero)
converting a floating-point number to an integer if the result does not fit
comparing two numbers if one of them is a NaN.
If the Invalid Operation exception is not trapped, all the above operations return
a quiet NaN, except for conversion to an integer, which returns zero (as there are
no quiet NaNs in integers).
The Divide by Zero exception happens if you divide a finite nonzero number by
zero. (Dividing zero by zero gives an Invalid Operation exception. Dividing
infinity by zero is valid and returns infinity.) If Divide by Zero is not trapped, the
operation returns infinity.
The Overflow exception happens when the result of an operation is too big to fit
into the format. This happens, for example, if you add the largest representable
number (marked d in Table 5-12 on page 5-32) to itself. If Overflow is not
trapped, the operation returns infinity, or the largest finite number, depending on
the rounding mode.
The Underflow exception can happen when the result of an operation is too small
to be represented as a normalized number (with Exp at least 1). The situations that
cause
Underflow depends on whether it is trapped or not:
If Underflow is trapped, it occurs whenever a result is too small to be
represented as a normalized number.
If Underflow is not trapped, it only occurs if the result actually loses
accuracy because it is so small. So, for example, dividing the
float
number
0x00800000
by 2 does not signal Underflow, because the result (
0x00400000
)
is still as accurate as it would be if Exp had a greater range. However, trying
to multiply the
float
number
0x00000001
by 1.5 does signal Underflow.