Provided by: manpages-dev_4.15-1_all

**NAME**

logb, logbf, logbl - get exponent of a floating-point value

**SYNOPSIS**

#include<math.h>doublelogb(doublex);floatlogbf(floatx);longdoublelogbl(longdoublex);Link with-lm. Feature Test Macro Requirements for glibc (seefeature_test_macros(7)):logb(): _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 500 || /* Since glibc 2.19: */ _DEFAULT_SOURCE || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCElogbf(),logbl(): _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || /* Since glibc 2.19: */ _DEFAULT_SOURCE || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

**DESCRIPTION**

These functions extract the exponent from the internal floating-point representation ofxand return it as a floating-point value. The integer constantFLT_RADIX, defined in<float.h>, indicates the radix used for the system's floating-point representation. IfFLT_RADIXis 2,logb(x)is equal tofloor(log2(x)), except that it is probably faster. Ifxis subnormal,logb() returns the exponentxwould have if it were normalized.

**RETURN** **VALUE**

On success, these functions return the exponent ofx. Ifxis a NaN, a NaN is returned. Ifxis zero, then a pole error occurs, and the functions return -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively. Ifxis negative infinity or positive infinity, then positive infinity is returned.

**ERRORS**

Seemath_error(7) for information on how to determine whether an error has occurred when calling these functions. The following errors can occur: Pole error:xis 0 A divide-by-zero floating-point exception (FE_DIVBYZERO) is raised. These functions do not seterrno.

**ATTRIBUTES**

For an explanation of the terms used in this section, seeattributes(7). ┌─────────────────────────┬───────────────┬─────────┐ │Interface│Attribute│Value│ ├─────────────────────────┼───────────────┼─────────┤ │logb(),logbf(),logbl() │ Thread safety │ MT-Safe │ └─────────────────────────┴───────────────┴─────────┘

**CONFORMING** **TO**

C99, POSIX.1-2001, POSIX.1-2008.

**SEE** **ALSO**

ilogb(3),log(3)

**COLOPHON**

This page is part of release 4.15 of the Linuxman-pagesproject. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. 2017-09-15 LOGB(3)