Inhaltsverzeichnis

logb()

#include <cmath>

double logb (double x) 

Liefert den ganzzahligen Logarithmus von x zur Basis 2 für x>0.

Parameter

x positiver, reeller Logarithmand

Ergebnis

Rückgabewert: trunc(log2(x)).

Siehe auch

ldexp(), log2(), ilogb().

Beispiel

logb.cpp
#include <cmath>
#include <iostream>
 
int main()
{
  std::cout << "logb(8.0) = " << std::logb(8.0) << '\n';
  return 0;
}