ilogbd32, ilogbd64, and ilogbd128 Subroutines

Purpose

Returns an unbiased exponent.

Syntax

#include <math.h>

int ilogbd32 (x)
_Decimal32 x;

int ilogbd64 (x)
_Decimal64 x;

int ilogbd128 (x)
_Decimal128 x;

Description

The ilogbd32, ilogbd64, and ilogbd128 subroutines return the integral part of logr | x | as a signed integral value, for nonzero x, where r is the radix of the machine's floating-point arithmetic (r=10).

An application that wants to check for error situations set the errno global variable to zero and call the feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. On return, if the errno is of the value of nonzero or the fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is of the value of nonzero, an error has occurred.

Parameters

Item Description
x Specifies the value to be computed.

Return Values

Upon successful completion, the ilogbd32, ilogbd64, and ilogbd128 subroutines return the exponent part of x as a signed integer value. They are equivalent to calling the corresponding logb functions and casting the returned value to type int.

If x is 0, a domain error occurs, and the value FP_ILOGB0 is returned.

If x is ±Inf, a domain error occurs, and the value {INT_MAX} is returned.

If x is a NaN, a domain error occurs, and the value FP_ILOGBNAN is returned.

If the correct value is greater than {INT_MAX}, {INT_MAX} is returned and a domain error occurs.

If the correct value is less than {INT_MIN}, {INT_MIN} is returned and a domain error occurs.