SETFP(3M) COMMAND REFERENCE SETFP(3M)
NAME
setfp, setfp_hw - set m68881 floating point unit to desired
state.
SYNOPSIS
#include <math.h>
setfp (round, precision, trap_mask)
setfp_hw (value, clearit)
DESCRIPTION
Setfp is the high-level user interface used to set the
rounding mode, precision, and exception trap vector of the
m68881. Additionally, the trap_mask can be used to request
a clear of the floating point status register and/or
floating point instruction address register. A value of -1
in any of the parameters means no change for that feature.
Setfp_hw is the low-level user interface used to set the
m68881. Value is the vector that is or'ed into the m68881
to enable the desired features. Clearit is the vector that
is and'ed into the m68881 to disable previously enabled
features. Additionally, clearit can be used to request a
clear of the floating point status register and/or floating
point instruction address register.
The rounding modes affect numbers which can not be
represented exactly in IEEE floating point format; that is,
numbers for which the binary representation of a decimal
number requires more mantissa bits than are available. Many
familiar numbers (such as 0.3) require infinitely long
binary mantissas to be represented exactly. The choice of
rounding mode selects which method of rounding shall be
used. Only one rounding mode may be selected at a time.
The default rounding mode is FP_RND_NEAREST.
Rounding modes: Meaning:
FP_RND_NEAREST round to nearest number, if tie use even number
FP_RND_TRUNCATE round toward 0 by truncating
FP_RND_DOWN round toward negative infinity
FP_RND_UP round toward positive infinity
The precision modes affect the number of mantissa bits used
to represent numbers stored in the floating point registers
of the m68881. The default precision mode is
FP_PREC_DOUBLE. Only one precision mode may be selected at
a time. For programs or applications which heavily depend
on repititive floating point calculations, it is strongly
recommended that the precision mode be set to
FP_PREC_EXTENDED. Otherwise, the cumulative error resulting
Printed 4/6/89 1
SETFP(3M) COMMAND REFERENCE SETFP(3M)
from the lessened precision will cause the m68881 to yield
incorrect results.
Precision modes: Meaning:
FP_PREC_EXTENDED extended precision, 64 bits
FP_PREC_SINGLE single precision, 24 bits
FP_PREC_DOUBLE double precision, 53 bits
The trap_mask is used to choose which classes of floating
point exceptions will be ignored, and which will cause
exceptions. Any, all, or none of the exception classes may
be enabled at any given time by or'ing the desired exception
classes together. Previous enabled traps are cleared when a
new trap_mask (other than -1) is selected. The default
setting for trap_mask clears the floating point status and
instruction address registers, and enables the FP_TRP_BSUN,
FP_TRP_OPERR, FP_TRP_OVFL, and FP_TRP_DZ exception classes.
Exception classes: Meaning:
FP_TRP_BSUN trap when BSUN set
FP_TRP_SNAN trap when SNAN set
FP_TRP_OPERR trap when OPERR set
FP_TRP_OVFLO trap when OVFL set
FP_TRP_UNFLO trap when UNFL set
FP_TRP_DIVZERO trap when DZ set
FP_TRP_INEX1 trap when INEX1 set
FP_TRP_INEX2 trap when INEX2 set
FP_CLR_FPSR clear FPSR status
FP_CLR_FPIAR clear FPIAR status
For details on the various floating point exception classes,
see the Motorola MC68881 Floating-Point Coprocessor User's
Manual (available from Prentice-Hall).
FILES
/usr/lib/libm.a
Mathematical library functions.
/usr/include/setfp.h
Defines to set m68881 to desired state.
Printed 4/6/89 2
%%index%%
na:288,124;
sy:412,897;
de:1309,2648;4317,2183;
fi:6500,282;
%%index%%000000000094