Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 849 Bytes

093_log.asciidoc

File metadata and controls

53 lines (34 loc) · 849 Bytes

log

NAME

log - Returns the natural logarithm of parameter x.

SYNOPSIS
#include <math.h>

double log(double x);
DESCRIPTION

The log() function returns the natural logarithm of x.

Warning
You’ll also need to link the program against the math library (see example below) using the -lm compile/link option.
RETURN VALUE

Logarithm naturalis of x.

ERRORS
  • EDOM - The argument x is negative.

  • ERANGE - The argument x is zero. The log of zero is not defined.

SEE ALSO

log10, exp, pow, sqrt

EXAMPLE
link:src/log.c[role=include]
OUTPUT
$ gcc -Wall -lm log.c
$ ./a.out
ln(5.500000) = 1.704748