Latest web development tutorials

C-Bibliotheksfunktionen - log ()

C Standard-Bibliothek - <math.h> C Standard - Bibliothek - <math.h>

Beschreibung

C - BibliotheksfunktionenDoppel log (double x) Gibt xnatürlichen Logarithmus (Basis e Logarithmus).

Erklärung

Hier ist die Erklärung log () Funktion.

double log(double x)

Parameter

  • x - Fließkommawert.

Rückgabewert

Diese Funktion gibt den natürlichen Logarithmus von x.

Beispiele

Das folgende Beispiel veranschaulicht die Funktion log () verwendet wird.

#include <stdio.h>
#include <math.h>

int main ()
{
   double x, ret;
   x = 2.7;

   /* 计算 log(2.7) */
   ret = log(x);
   printf("log(%lf) = %lf", x, ret);
   
   return(0);
}

Lassen Sie uns zusammenzustellen und um das obige Programm ausführen, die in der folgenden führen:

log(2.700000) = 0.993252

C Standard-Bibliothek - <math.h> C Standard - Bibliothek - <math.h>