function
<cmath> <ctgmath>
ilogbint ilogb (double x);int ilogbf (float x);int ilogbl (long double x);
int ilogb (double x);int ilogb (float x);int ilogb (long double x);int ilogb (T x); // additional overloads for integral types
Integer binary logarithm
Returns the integral part of the logarithm of |x|, using FLT_RADIX as base for the logarithm.This is the exponent used internally by the machine to express the floating-point value x, when it uses a significand between 1.0
and FLT_RADIX, so that, for a positive x:
x = significand * FLT_RADIX exponent
Generally, FLT_RADIX is 2
, and the value returned by this function is one less than the exponent obtained with frexp (because of the different significand normalization as [1.0,2.0)
instead of [0.5,1.0)
).
Header
<tgmath.h>provides a type-generic macro version of this function.
are provided in this header (
<cmath>
) for the
integral types: These overloads effectively cast
xto a
double
before calculations (defined for
Tbeing any
integral type).
If an domain error occurs:
If an overflow range error occurs:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ilogb example */
#include <stdio.h> /* printf */
#include <math.h> /* ilogb */
int main ()
{
double param;
int result;
param = 10.0;
result = ilogb (param);
printf ("ilogb(%f) = %d\n", param, result);
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4