LOGB(3) Library Functions Manual LOGB(3)

logbreturn exponent as a floating-point number

#include <math.h>

double
logb(double x);

long double
logbl(long double x);

float
logbf(float x);

The () functions return the exponent of x, represented as a floating-point number.

logb(±0) returns -infinity and raises the "divide-by-zero" floating-point exception.

(±infinity) returns +infinity.

If you need to apply the logb() functions to SIMD vectors or arrays, using the following functions provided by the Accelerate.framework may give significantly better performance:

#include <Accelerate/Accelerate.h>

vFloat (vFloat x);
void (float *y, const float *x, const int *n);
void (double *y, const double *x, const int *n);

ilogb(3) log(3) math(3)

The logb() functions conform to ISO/IEC 9899:2011.

August 21, 2012 macOS 15.0