Skip to content

Latest commit

 

History

History
82 lines (58 loc) · 2.45 KB

ilogb-ilogbf-ilogbl2.md

File metadata and controls

82 lines (58 loc) · 2.45 KB
title description ms.date api_name api_location api_type topic_type f1_keywords helpviewer_keywords ms.assetid
ilogb, ilogbf, ilogbl2
API reference for ilogb, ilogbf, and ilogbl2; which retrieve an integer that represents the unbiased base-2 exponent of the specified value.
9/1/2020
ilogb
ilogbf
ilogbl
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-math-l1-1-0.dll
DLLExport
apiref
ilogb
ilogbf
ilogbl
math/ilogb
math/ilogbf
math/ilogbl
ilogb function
ilogbf function
ilogbl function
9ef19d57-1caa-41d5-8233-2faad3562fcb

ilogb, ilogbf, ilogbl

Retrieves an integer that represents the unbiased base-2 exponent of the specified value.

Syntax

int ilogb(
   double x
);

int ilogb(
   float x
); //C++ only

int ilogb(
   long double x
); //C++ only

int ilogbf(
   float x
);

int ilogbl(
   long double x
);

#define ilogbl(X) // Requires C11 or higher

Parameters

x
The specified value.

Return value

If successful, these functions return the base-2 exponent of x as a signed int value.

Otherwise, the functions return one of the following values, defined in <math.h>:

Input Result
±0 FP_ILOGB0
± INF, ± NAN, IND FP_ILOGBNAN

Errors are reported as specified in _matherr.

Remarks

Because C++ allows overloading, you can call overloads of ilogb that take and return float and long double types. In a C program, unless you're using the <tgmath.h> macro to call this function, ilogb always takes and returns a double.

If you use the <tgmath.h> ilogb() macro, the type of the argument determines which version of the function is selected. See Type-generic math for details.

Calling this function is similar to calling the equivalent logb function, then casting the return value to int.

Requirements

Routine C header C++ header
ilogb, ilogbf, ilogbl <math.h> <cmath>
ilogb macro <tgmath.h>

For more compatibility information, see Compatibility.

See also

Alphabetical function reference
frexp
logb, logbf, logbl, _logb, _logbf