NAME
ieee_sun, fp_class, isinf, isnormal, issubnormal, iszero,
signbit, nonstandard_arithmetic, standard_arithmetic,
ieee_retrospective - miscellaneous functions for IEEE arith-
metic
SYNOPSIS
cc [ flag ... ] file ... -lsunmath -lm [ library ... ]
#include <sunmath.h>
enum fp_class_type fp_class(double x);
int isinf(double x);
int isnormal(double x);
int issubnormal(double x);
int iszero(double x);
int signbit(double x);
void nonstandard_arithmetic(void);
void standard_arithmetic(void);
#include <stdio.h>
void ieee_retrospective(FILE *f);
DESCRIPTION
Please see copysign(3M), ilogb(3M), isnan(3M),
nextafter(3M), remainder(3M), and scalbn(3M), for a descrip-
tion of a few more commonly used (and standardized)
ANSI/IEEE Std 754-1985 related functions.
Most of the functions provide capabilities suggested in the
Appendix of ANSI/IEEE Std 754-1985.
fp_class(x) corresponds to the IEEE's class() and classifies
x as zero, subnormal, normal, oo, or quiet or signaling NaN;
<floatingpoint.h> defines enum fp_class_type.
The following functions return 0 if the indicated condition
is not satisfied:
isinf(x) returns 1 if x is oo
isnormal(x) returns 1 if x is normal
issubnormal(x) returns 1 if x is subnormal
iszero(x) returns 1 if x is zero
signbit(x) returns 1 if x's sign bit is set
nonstandard_arithmetic() and standard_arithmetic() are mean-
ingful on systems that provide an alternative faster mode of
floating-point arithmetic that does not conform to the
default IEEE Standard. Nonstandard modes vary among imple-
mentations; nonstandard mode may, for instance, result in
setting subnormal results to zero or in treating subnormal
operands as zero, or both, or something else.
standard_arithmetic() reverts to the default standard mode.
On systems that provide only one mode, these functions have
no effect.
ieee_retrospective(f) prints a message to the FILE *f list-
ing all non-default floating-point modes and status in
effect when called, including IEEE accrued exception-
occurred status bits, IEEE rounding direction and precision
modes, IEEE trap-enable modes, and nonstandard arithmetic
mode. ieee_retrospective(f) is intended to be used at the
end of a program to indicate exceptional floating-point con-
ditions that might have affected the result.
A program can explicitly call ieee_retrospective at any
time. Fortran programs compiled with f95 in -f77 compatibil-
ity mode automatically call ieee_retrospective before they
exit. C/C++ programs and Fortran programs compiled with f95
in the default mode do not automatically call
ieee_retrospective. The f95 compiler enables trapping on
common exceptions by default, so unless a program either
explicitly disables trapping or installs a SIGFPE handler,
it will immediately abort when such an exception occurs. In
-f77 compatibility mode, the compiler does not enable trap-
ping, so when floating point exceptions occur, the program
continues execution and reports those exceptions via the
ieee_retrospective output on exit.
SEE ALSO
copysign(3M), ieee_flags(3M), ieee_handler(3M), ilogb(3M),
isnan(3M), nextafter(3M), remainder(3M), scalbn(3M),
floatingpoint(5).