Copyright © 1997 The Open Group

log - natural logarithm function

`#include <math.h> double log(double`

x);

Thelog()function computes the natural logarithm ofx,log_{e}(x). The value ofxmust be positive.An application wishing to check for error situations should set

errnoto 0 before callinglog(). Iferrnois non-zero on return, or the return value is NaN, an error has occurred.

Upon successful completion,log()returns the natural logarithm ofx.If

xis NaN, NaN is returned anderrnomay be set to [EDOM].If

xis less than 0, -HUGE_VAL or NaN is returned, anderrnois set to [EDOM].If

xis 0, -HUGE_VAL is returned anderrnomay be set to [ERANGE].

Thelog()function will fail if:

- [EDOM]
- The value of
xis negative.The

log()function may fail if:

- [EDOM]
- The value of
xis NaN.- [ERANGE]
- The value of
xis 0.No other errors will occur.

None.

None.

None.

exp(),isnan(),log10(),log1p(),<math.h>.

Derived from Issue 1 of the SVID.

Copyright © 1997 The Open Group

[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]