2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
8 .\" References consulted:
9 .\" Linux libc source code
10 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
12 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
13 .\" Modified 1995-08-14 by Arnt Gulbrandsen <agulbra@troll.no>
14 .\" Modified 2002-07-27 by Walter Harms
15 .\" (walter.harms@informatik.uni-oldenburg.de)
17 .TH log 3 (date) "Linux man-pages (unreleased)"
19 log, logf, logl \- natural logarithmic function
22 .RI ( libm ", " \-lm )
27 .BI "double log(double " x );
28 .BI "float logf(float " x );
29 .BI "long double logl(long double " x );
33 Feature Test Macro Requirements for glibc (see
34 .BR feature_test_macros (7)):
40 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
41 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
42 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
45 These functions return the natural logarithm of
48 On success, these functions return the natural logarithm of
58 is 1, the result is +0.
63 positive infinity is returned.
68 then a pole error occurs, and the functions return
77 is negative (including negative infinity), then
78 a domain error occurs, and a NaN (not a number) is returned.
82 for information on how to determine whether an error has occurred
83 when calling these functions.
85 The following errors can occur:
87 Domain error: \fIx\fP is negative
91 An invalid floating-point exception
95 Pole error: \fIx\fP is zero
99 A divide-by-zero floating-point exception
103 For an explanation of the terms used in this section, see
109 Interface Attribute Value
116 T} Thread safety MT-Safe
123 The variant returning
128 In glibc 2.5 and earlier,
131 of a NaN produces a bogus invalid floating-point