Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

log, logf, logl - Natürlicher Logarithmus

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double log(double x);
float logf(double x); (C11)
long double logl(long double x); (C11)

Diese Funktionen berechnen den natürlichen Logarithmus der positiven Gleitkommazahl x zur Basis e.

Returnwert 

ln(x)

für positive x.

 

-HUGE_VAL
-HUGE_VALF
-HUGE_VALL

abhängig vom Funktionstyp,
falls x kleiner 0 ist; zusätzlich wird errno auf EDOM gesetzt (domain error)
oder
falls x gleich 0 ist; zusätzlich wird errno auf ERANGE gesetzt.

Beispiel

#include <math.h>
#include <stdio.h>
int main(void)
{
  double x;
  printf("Beispiel fuer log(x): Bitte x eingeben\n");
  if(scanf("%lf", &x) == 1)
  printf("x = %g log(x) = %g\n", x, log(x));
  return 0;
}

Siehe auch

log2, log10, exp, exp2