Chapter Contents

Previous

Next
ilogb

ilogb



Extract the floating-point exponent

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <math.h>

   int ilogb(double x);
   int ilogbf(float x);
   int ilogbl(long double x);


DESCRIPTION

ilogb extracts the exponent of a floating-point number. For hexadecimal floating point, the exponent represents a power of sixteen; for binary, it represents a power of two.

The function name ilogbf should be used for float arguments, and ilogbl for long double arguments. Alternately, if the header file tgmath.h is included, ilogb may be used with any numeric argument type.


RETURN VALUE

ilogb returns the exponent of the argument as an integer. ilogb(0.0) returns the value FP_ILOGB0, and ilogb(NaN) returns FP_ILOGBNAN. ilogb(infinity) returns the largest integer value.


RELATED FUNCTIONS

frexp, logb


SEE ALSO

"Mathematical Functions" in Chapter 2, "Function Categories"


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.