Chapter Contents

Previous

Next
logb

logb



Extract the floating-point exponent

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <math.h>

   double logb(double x);
   float logbf(float x);
   long double logbl(long double x);


DESCRIPTION

logb 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.

Note:   The value returned by logb is an exact integer, even though its type is double.  [cautionend]

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


RETURN VALUE

logb returns the exponent of the argument as a floating-point value. logb(0.0) returns minus infinity (or -HUGE_VAL for HFP), and logb(NaN) returns a NaN. logb(infinity) returns positive infinity.


RELATED FUNCTIONS

frexp, ilogb


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.