cpp/numeric/math/ilogb

@1-3@ Extracts the value of the unbiased exponent from the floating-point argument, and returns it as a signed integer value. @4@ Expands to integer constant expression whose value is either or. @5@ Expands to integer constant expression whose value is either or. @A@ Additional overloads are provided for all integer types, which are treated as.

Formally, the unbiased exponent is the integral part of $log r|num|$ as a signed integral value, for non-zero, where is  and  is the floating-point type of.

Return value
If no errors occur, the unbiased exponent of is returned as a signed int value.

If is zero, fp_ilogb0 is returned.

If is infinite, int_max is returned.

If is a NaN, fp_ilogbnan is returned.

If the correct result is greater than int_max or smaller than int_min, the return value is unspecified.

Error handling
Errors are reported as specified in math_errhandling.

A domain error or range error may occur if is zero, infinite, or NaN.

If the correct result is greater than int_max or smaller than int_min, a domain error or a range error may occur.

If the implementation supports IEEE floating-point arithmetic (IEC 60559),
 * If the correct result is greater than int_max or smaller than int_min, fe_invalid is raised.
 * If is ±0, ±∞, or NaN, fe_invalid is raised.
 * In all other cases, the result is exact (fe_inexact is never raised) and the current rounding mode is ignored.