# log(), logf(), log10(), log10f(), log1p(), log1pf()compute natural logarithm

## SYNOPSIS

#include <math.h>

double log(double x)

float logf(float x)

double log2(double x)

float log2f(float x)

double log10(double x)

float log10f(float x)

double log1p(double x)

float log1pf(float x)

## DESCRIPTION

The log() function computes the value of the natural logarithm of argument x.

The log2() and log2f() functions return the base 2 logarithm of argument x.

The log10() function computes the value of the logarithm of argument x to base 10.

The log1p() function computes the value of log(1+x) accurately even for tiny argument x.

To check for error situations, set errno to 0 before calling log(). If errno is non-zero on return, or the return value is NaN, an error has occurred. The logf(), log2f(), log10f(), and log1pf() functions are single-precision versions of log(), log2(), log10() and log1p() respectively.

## PARAMETERS

x

Is the number whose logarithm is to be computed.

## RETURN VALUES

If successful, these functions return the requested results.

If x is NaN, NaN is returned.

For log(), log2(), and log10() where x is < 0.0, and for log1p() where x is < 1.0 then:

• In IEEE mode, a value of NaN is returned.

• In POSIX mode, a value of -HUGE_VAL is returned and errno is set to EDOM.

• In SVID mode, a value of -HUGE is returned and the matherr() is called.

• In XOPEN mode, a value of -HUGE_VAL is returned and the matherr() is called.

For log(), log2(), and log10() where x is 0.0, and for log1p() where x is 1.0, then:

• In IEEE mode, a value of -HUGE_VAL is returned.

• In POSIX mode, a value of -HUGE_VAL is returned and errno is set to ERANGE.

• In SVID mode, a value of -HUGE is returned and the matherr() function is called.

• In XOPEN mode, a value of -HUGE_VAL is returned and the matherr() function is called.

## CONFORMANCE

log(), log2(), log10(), log1p(): ANSI/ISO 9899:1999 'ISO C99'

MT-Safe.

None.

## AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition