]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/log.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / log.3
CommitLineData
fea681da 1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
5109fcf9
MK
2.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3.\" <mtk.manpages@gmail.com>
fea681da 4.\"
5fbde956 5.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
6.\"
7.\" References consulted:
8.\" Linux libc source code
9.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10.\" 386BSD man pages
11.\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
12.\" Modified 1995-08-14 by Arnt Gulbrandsen <agulbra@troll.no>
13.\" Modified 2002-07-27 by Walter Harms
14.\" (walter.harms@informatik.uni-oldenburg.de)
15.\"
45186a5d 16.TH LOG 3 2021-03-22 "Linux man-pages (unreleased)"
fea681da
MK
17.SH NAME
18log, logf, logl \- natural logarithmic function
b73c05fc
AC
19.SH LIBRARY
20Math library
8fc3b2cf 21.RI ( libm ", " \-lm )
fea681da
MK
22.SH SYNOPSIS
23.nf
24.B #include <math.h>
68e4db0a 25.PP
fea681da 26.BI "double log(double " x );
fea681da 27.BI "float logf(float " x );
fea681da
MK
28.BI "long double logl(long double " x );
29.fi
68e4db0a 30.PP
d39ad78f 31.RS -4
5109fcf9
MK
32Feature Test Macro Requirements for glibc (see
33.BR feature_test_macros (7)):
d39ad78f 34.RE
68e4db0a 35.PP
5109fcf9
MK
36.BR logf (),
37.BR logl ():
9d2adbae 38.nf
5c10d2c5 39 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
9d2adbae
MK
40 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
41 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
42.fi
fea681da 43.SH DESCRIPTION
5600f73a 44These functions return the natural logarithm of
022671eb 45.IR x .
5109fcf9
MK
46.SH RETURN VALUE
47On success, these functions return the natural logarithm of
48.IR x .
847e0d88 49.PP
5109fcf9
MK
50If
51.I x
52is a NaN,
53a NaN is returned.
847e0d88 54.PP
5109fcf9
MK
55If
56.I x
57is 1, the result is +0.
847e0d88 58.PP
5109fcf9
MK
59If
60.I x
61is positive infinity,
62positive infinity is returned.
847e0d88 63.PP
5109fcf9
MK
64If
65.I x
66is zero,
efe294cb 67then a pole error occurs, and the functions return
cd415e73
MK
68.RB \- HUGE_VAL ,
69.RB \- HUGE_VALF ,
5109fcf9 70or
cd415e73 71.RB \- HUGE_VALL ,
5109fcf9 72respectively.
847e0d88 73.PP
5109fcf9
MK
74If
75.I x
76is negative (including negative infinity), then
efe294cb 77a domain error occurs, and a NaN (not a number) is returned.
fea681da 78.SH ERRORS
5109fcf9
MK
79See
80.BR math_error (7)
81for information on how to determine whether an error has occurred
82when calling these functions.
83.PP
84The following errors can occur:
fea681da 85.TP
5109fcf9
MK
86Domain error: \fIx\fP is negative
87.I errno
88is set to
89.BR EDOM .
90An invalid floating-point exception
91.RB ( FE_INVALID )
92is raised.
fea681da 93.TP
5109fcf9
MK
94Pole error: \fIx\fP is zero
95.I errno
96is set to
97.BR ERANGE .
98A divide-by-zero floating-point exception
99.RB ( FE_DIVBYZERO )
100is raised.
83afbd20
MS
101.SH ATTRIBUTES
102For an explanation of the terms used in this section, see
103.BR attributes (7).
c466875e
MK
104.ad l
105.nh
83afbd20
MS
106.TS
107allbox;
c466875e 108lbx lb lb
83afbd20
MS
109l l l.
110Interface Attribute Value
111T{
112.BR log (),
113.BR logf (),
114.BR logl ()
115T} Thread safety MT-Safe
116.TE
c466875e
MK
117.hy
118.ad
119.sp 1
3113c7f3 120.SH STANDARDS
9a74e018 121C99, POSIX.1-2001, POSIX.1-2008.
847e0d88 122.PP
5109fcf9
MK
123The variant returning
124.I double
125also conforms to
68e1685c 126SVr4, 4.3BSD, C89.
5625342f
MK
127.SH BUGS
128In glibc 2.5 and earlier,
129taking the
130.BR log ()
131of a NaN produces a bogus invalid floating-point