The C++
ilogb()
function returns the square root of sum of square of arguments passed. It is defined in <cmath> header file.
Syntax
ilogb(double x);
Parameters
The
ilogb()
function takes a single argument.
Return value
Returns the integral part of the logarithm of
|x|
.
- If the argument is
0
, it returnsFP_LOGB0
. - If the argument is
NaN
, it returnsFP_LOGBNAN
. - If the argument is
infinite
, it returnsINT_MAX
.
ilogb() prototype [As of C++ 11 standard]
int ilogb (double x); int ilogb (float x); int ilogb (long double x); int ilogb (T x);
Example : C++ ilogb()
#include <stdio.h> #include <math.h> int main () { double param; int result; param = 44.0; result = ilogb (param); printf ("ilogb(%f) = %d\n", param, result); return 0; }
Output
ilogb(44.000000) = 5