Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

pow, powf, powl - Allgemeine Exponentialfunktion

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double pow(double x, double y);
float powf(float x, float y); (C11)
long double powl(long double x, long double y); (C11)

Diese Funktionen berechnen xy.
Falls x gleich 0 ist, muss y positiv sein,
falls x negativ ist, muss y ganzzahlig sein.

Returnwert

x y

falls x, y und das Ergebnis im zulässigen Gleitkommaintervall liegen.


+/-HUGE_VAL
+/-HUGE_VALF
+/-HUGE_VALL

abhängig vom Funktionstyp und Vorzeichen von x, bei Überlauf.

Zusätzlich wird errno auf ERANGE gesetzt (Resultat zu groß).


1.0

wenn x und y gleich 0 sind.


-HUGE_VAL
-HUGE_VALF
-HUGE_VALL

abhängig vom Funktionstyp, wenn x gleich 0 und y kleiner 0 ist.
Zusätzlich wird errno auf EDOM gesetzt.


undefiniert

wenn x kleiner 0 und y nicht ganzzahlig ist. Zusätzlich wird errno auf EDOM gesetzt.

Beispiel

Folgendes Programm berechnet x y für eingelesene Argumente x und y

#include <math.h>
#include <stdio.h>
int main(void)
{
  double x, y;
  scanf("%lf %lf", &x, &y);
  printf("%g**%g : %g\n", x, y, pow(x,y));
  return 0;
}

Siehe auch  exp, hypot, log, log10, sinh, sqrt