logb - C math.h

C examples for math.h:logb

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Returns the logarithm of |x|, using FLT_RADIX as base for the logarithm.

On most platforms, FLT_RADIX is 2.

Prototype

long double logbl (long double x);
long double logb (long double x);
     double logb  (double x);
      float logbf (float x);
      float logb (float x);
     double logb (T x);           

Parameters

Parameter Description
x Value whose logarithm is calculated.

Return Value

The base-FLT_RADIX logarithm of x.

Example

Demo Code


#include <stdio.h>
#include <math.h>

int main ()//ww w .j av  a  2s.c  om
{
  
  double param = 1024.0;
  
  double result = logb (param);
  
  printf ("logb (%f) = %f.\n", param, result );
  
  return 0;
}

Related Tutorials