1LOG(P)                     POSIX Programmer's Manual                    LOG(P)
2
3
4

NAME

6       log, logf, logl - natural logarithm function
7

SYNOPSIS

9       #include <math.h>
10
11       double log(double x);
12       float logf(float x);
13       long double logl(long double x);
14
15

DESCRIPTION

17       These  functions  shall compute the natural logarithm of their argument
18       x, log_e(x).
19
20       An application wishing to check for error situations should  set  errno
21       to  zero  and  call  feclearexcept(FE_ALL_EXCEPT)  before calling these
22       functions.  On return, if errno is non-zero or  fetestexcept(FE_INVALID
23       |  FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
24       occurred.
25

RETURN VALUE

27       Upon successful completion, these functions shall  return  the  natural
28       logarithm of x.
29
30       If  x  is  ±0,  a  pole error shall occur and log(), logf(), and logl()
31       shall return -HUGE_VAL, -HUGE_VALF, and -HUGE_VALL, respectively.
32
33       For finite values of x that are less than 0,    or if  x  is  -Inf,   a
34       domain  error  shall occur, and    either a NaN (if supported), or   an
35       implementation-defined value shall be returned.
36
37       If x is NaN, a NaN shall be returned.
38
39       If x is 1, +0 shall be returned.
40
41       If x is +Inf, x shall be returned.
42

ERRORS

44       These functions shall fail if:
45
46       Domain Error
47              The finite value of x is negative,    or x is -Inf.
48
49       If the integer expression (math_errhandling & MATH_ERRNO) is  non-zero,
50       then   errno  shall  be  set  to  [EDOM].  If  the  integer  expression
51       (math_errhandling &  MATH_ERREXCEPT)  is  non-zero,  then  the  invalid
52       floating-point exception shall be raised.
53
54       Pole Error
55              The value of x is zero.
56
57       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
58       then errno  shall  be  set  to  [ERANGE].  If  the  integer  expression
59       (math_errhandling  &  MATH_ERREXCEPT)  is non-zero, then the divide-by-
60       zero floating-point exception shall be raised.
61
62
63       The following sections are informative.
64

EXAMPLES

66       None.
67

APPLICATION USAGE

69       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
70       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
71       at least one of them must be non-zero.
72

RATIONALE

74       None.
75

FUTURE DIRECTIONS

77       None.
78

SEE ALSO

80       exp() , feclearexcept() , fetestexcept() , isnan() , log10() ,  log1p()
81       ,  the  Base  Definitions volume of IEEE Std 1003.1-2001, Section 4.18,
82       Treatment of Error Conditions for Mathematical Functions, <math.h>
83
85       Portions of this text are reprinted and reproduced in  electronic  form
86       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
87       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
88       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
89       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
90       event of any discrepancy between this version and the original IEEE and
91       The Open Group Standard, the original IEEE and The Open Group  Standard
92       is  the  referee document. The original Standard can be obtained online
93       at http://www.opengroup.org/unix/online.html .
94
95
96
97IEEE/The Open Group                  2003                               LOG(P)
Impressum