Inhaltsverzeichnis

log2()

#include <cmath>

double log2 (double x) 

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

Parameter

x positiver, reeller Logarithmand

Ergebnis

Rückgabewert: log(x)/log(2.0).

Siehe auch

exp2(), log(), log10().

Beispiel

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