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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       log, logf, logl - natural logarithm function
13

SYNOPSIS

15       #include <math.h>
16
17       double log(double x);
18       float logf(float x);
19       long double logl(long double x);
20
21

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

72       None.
73

APPLICATION USAGE

75       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
76       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
77       at least one of them must be non-zero.
78

RATIONALE

80       None.
81

FUTURE DIRECTIONS

83       None.
84

SEE ALSO

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