Log2 Function


It returns the logarithm of base 2 for the number .

Syntax:

float log2f(float num);

double log2(double num);

long double log2l(long double num);

Example:

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

  int main()
  {
    double x = 1.0;

    do {
      printf("No : %f  , Log : %f\n", x, log2(x));
      x++;
    } while (x<12.0);
    
	return 0;
  }   
 
Back