#include <cmath>
double pow (double x, double y)
Liefert die Potenz $x^y$. Für x < 0 muss y ganzzahlig sein.
x, y | Gleitkommazahlen |
Rückgabewert: $x^y$.
Für positive Basis ist das Ergebnis gleichwertig zu exp(y*log(x)).
Bei negativer Basis und nichtganzzahligem Exponent
tritt ein Argumentfehler EDOM ein,
ebenso bei x==0 und y⇐0.
Ein Bereichsfehler ERANGE tritt ein,
wenn das Ergebnis zu groß ist.
#include <cmath> #include <iostream> int main() { std::cout << "2 hoch 10 = " << std::pow(2.0, 10.0) << '\n'; }