Datasheet
Floating-point Support
5-18 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
__softfp__ieee_value_t myhandler(__ieee_value_t op1,
__ieee_value_t op2,
__ieee_edata_t edata);
The parameters to this function are:
•
op1
and
op2
are used to give the operands, or the intermediate result, for the
operation that caused the exception:
— For the Invalid Operation and Divide by Zero exceptions, the original
operands are supplied.
— For the Inexact Result exception, all that is supplied is the ordinary result
that would have been returned anyway. This is provided in
op1
.
— For the Overflow exception, an intermediate result is provided. This result
is calculated by working out what the operation would have returned if the
exponent range had been big enough, and then adjusting the exponent so
that it fits in the format. The exponent is adjusted by 192 (
0xC0
) in single
precision, and by 1536 (
0x600
) in double precision.
If Overflow happens when converting a
double
to a
float
, the result is
supplied in
double
format, rounded to single precision, with the exponent
biased by 192.
— For the Underflow exception, a similar intermediate result is produced, but
the bias value is added to the exponent instead of being subtracted. The
edata
parameter also contains a flag to show whether the intermediate result
has had to be rounded up, down, or not at all.
The type
__ieee_value_t
is defined as a union of all the possible types that an
operand can be passed as:
typedef union {
float f;
float s;
double d;
int i;
unsigned int ui;
long long l;
unsigned long long ul;
struct { int word1, word2; } str;
} __ieee_value_t;
•
edata
contains flags that give details about the exception that occurred, and what
operation was being performed. (The type
__ieee_edata_t
is a synonym for
unsigned int
.)
• The return value from the function is used as the result of the operation that
caused the exception.