ieee_test()

NAME

logb(), scalb(), significand() - IEEE test functions

SYNOPSIS

#include <math.h>

double logb (double x) double scalb (double x, double n) double significand (double x)

DESCRIPTION

These functions allow users to test conformance to the IEEE 754 standard.

logb(3) returns the exponent n of the argument x, n is a signed integer converted to double-precision floating-point. Specifically, it's the integral part of logr |x|, where r is the radix of the machine's floating point arithmetic. logb(+-Infinity) = +Infinity; logb(0) = -Infinity with a division by zero exception.

The scalb(x,n) function returns x(r**n), where r is the radix of the machine's floating point arithmetic. (For r=2, this is identical to ldexp(3).) The value is computed by exponent manipulation without first computing r**n.

significand(3) returns sig, where the argument x := sig*2**n with 1 <= sig < 2. The significand() value are not defined when x is 0, +-Infinity, or NaN.

RETURN VALUES

The logb() function returns the exponent of x. If x is zero, it returns -HUGE_VAL and sets errno. If x is +-Infinity, it returns Infinity. If x is NaN, it returns NaN and sets errno.

The scalb(3) function returns the value x(r**n) where r is the radix of the machine's floating point arithmetic.

ERRORS

The logb(3) function can fail for the following reasons:

[EDOM]
Either the x argument is zero, or it is NaN.
The scalb(3) function can fail for the following reasons:
[EDOM]
Either x or n is NaN.
[ERANGE]
The correct value will overflow or underflow.

NOTES

Note that the function ldexp(3) is slightly more portable than scalb(3), and that frexp(3) does the same jobs as scalb(3) and significand(3), in a slightly more portable manner. Both ldexp(3) and frexp(3) use the radix as base for the exponent, rather than 2.

SEE ALSO

frexp(3)

ieee(3)

ldexp(3)

math(3)