function
<cmath> <ctgmath>
logbdouble logb (double x); float logbf (float x);long double logbl (long double x);
double logb (double x); float logb (float x);long double logb (long double x); double logb (T x); // additional overloads for integral types
Compute floating-point base logarithm
Returns the logarithm of |x|, using FLT_RADIX as base for the logarithm.On most platforms, FLT_RADIX is 2
, and thus this function is equivalent to log2 for positive values.
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 a pole error occurs:
1
2
3
4
5
6
7
8
9
10
11
12
/* logb example */
#include <stdio.h> /* printf */
#include <math.h> /* logb */
int main ()
{
double param, result;
param = 1024.0;
result = logb (param);
printf ("logb (%f) = %f.\n", param, result );
return 0;
}
logb (1024.000000) = 10.000000
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