C log() Function

Last Updated:

C log()

The log() function returns the natural logarithm (base E) of the given number.

This function is defined in <math.h> header file.

Example

C Compiler
#include <stdio.h> #include <math.h> int main() { printf("%lf", log(2)); return 0; }

Syntax

double log(double x)

Parameter Values

ValueTypeExplanation
x Required Specifies a number.

Return Value

ValueExplanation
Number Returns the natural logarithm of the given number.
-Infinity If the given number is 0.

Share this Page

Meet the Author