this repo has no description
1.\" Copyright (c) 1985, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" from: @(#)exp.3 6.12 (Berkeley) 7/31/91
33.\" $Id: log.3,v 1.5 2004/12/20 21:35:45 scp Exp $
34.\"
35.Dd December 11, 2006
36.Dt LOG 3
37.Os BSD 4
38.Sh NAME
39.Nm log ,
40.Nm log2 ,
41.Nm log10 ,
42.Nm log1p ,
43.Nd logarithm functions
44.Sh SYNOPSIS
45.Fd #include <math.h>
46.Ft double
47.Fn log "double x"
48.Ft long double
49.Fn logl "long double x"
50.Ft float
51.Fn logf "float x"
52.Ft double
53.Fn log2 "double x"
54.Ft long double
55.Fn log2l "long double x"
56.Ft float
57.Fn log2f "float x"
58.Ft double
59.Fn log10 "double x"
60.Ft long double
61.Fn log10l "long double x"
62.Ft float
63.Fn log10f "float x"
64.Ft double
65.Fn log1p "double x"
66.Ft long double
67.Fn log1pl "long double x"
68.Ft float
69.Fn log1pf "float x"
70.Sh DESCRIPTION
71The
72.Fn log
73function computes the value of the natural logarithm of argument
74.Fa x.
75.Pp
76The
77.Fn log2
78function computes the value of the logarithm of argument
79.Fa x
80to base 2.
81.Pp
82The
83.Fn log10
84function computes the value of the logarithm of argument
85.Fa x
86to base 10.
87.Pp
88The
89.Fn log1p
90function computes
91the value of log(1+x) accurately even for very small values of
92.Fa x .
93.Sh SPECIAL VALUES
94.Fn log "�0"
95,
96.Fn log2 "�0"
97, and
98.Fn log10 "�0"
99return -infinity and raise the "divide-by-zero" floating-point exception.
100.Pp
101.Fn log "1"
102,
103.Fn log2 "1"
104, and
105.Fn log10 "1"
106return +0.
107.Pp
108.Fn log "x"
109,
110.Fn log2 "x"
111, and
112.Fn log10 "x"
113return a NaN and raise the "invalid" floating-point exception for x < 0.
114.Pp
115.Fn log "+infinity"
116,
117.Fn log2 "+infinity"
118, and
119.Fn log10 "+infinity"
120return +infinity.
121.Pp
122.Fn log1p "�0"
123returns �0.
124.Pp
125.Fn log1p "-1"
126returns -infinity and raises the "divide-by-zero" floating-point exception.
127.Pp
128.Fn log1p "x"
129returns a NaN and raises the "invalid" floating-point exception for x < -1.
130.Pp
131.Fn log1p "+infinity"
132returns +infinity.
133.Sh SEE ALSO
134.Xr math 3 ,
135.Xr exp 3 ,
136.Xr exp2 3 ,
137.Xr expm1 3 ,
138.Xr pow 3
139.Sh STANDARDS
140The
141.Fn log
142,
143.Fn log2
144,
145.Fn log10
146, and
147.Fn log1p
148functions conform to ISO/IEC 9899:1999(E).