Namespaces
Variants
Actions

std::ilogb, std::ilogbf, std::ilogbl

From cppreference.com
< cpp‎ | numeric‎ | math
 
 
 
 
Defined in header <cmath>
(1)
int ilogb ( float num );

int ilogb ( double num );

int ilogb ( long double num );
(since C++11)
(until C++23)
constexpr int ilogb( /* floating-point-type */ num );
(since C++23)
int ilogbf( float num );
(2) (since C++11)
(constexpr since C++23)
int ilogbl( long double num );
(3) (since C++11)
(constexpr since C++23)
#define FP_ILOGB0   /* implementation-defined */
(4) (since C++11)
#define FP_ILOGBNAN /* implementation-defined */
(5) (since C++11)
Defined in header <cmath>
template< class Integer >
int ilogb ( Integer num );
(A) (since C++11)
(constexpr since C++23)
1-3) Extracts the value of the unbiased exponent from the floating-point argument num, and returns it as a signed integer value. The library provides overloads of std::ilogb for all cv-unqualified floating-point types as the type of the parameter num.(since C++23)
4) Expands to integer constant expression whose value is either INT_MIN or -INT_MAX.
5) Expands to integer constant expression whose value is either INT_MIN or +INT_MAX.
A) Additional overloads are provided for all integer types, which are treated as double.

Formally, the unbiased exponent is the integral part of logr|num| as a signed integral value, for non-zero num, where r is std::numeric_limits<T>::radix and T is the floating-point type of num.

Contents