ieee_sun(3M)

NAME
ieee_sun, fp_class, isinf, isnormal, issubnormal, iszero, signbit, nonstandard_arithmetic, standard_arithmetic, ieee_retrospective - miscellaneous functions for IEEE arithmetic

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 ieee_functions(3M) for a description 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, ∞, 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 ∞
    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 meaningful 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 implementations; 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 listing 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 conditions that might have affected the result.

SEE ALSO
ieee_flags(3M), ieee_functions(3M), ieee_handler(3M), floatingpoint(5).