xref: /netbsd-src/lib/libm/man/exp.3 (revision 7690962a143b99b7634b1782f4680d8cffeb0a2f)
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. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     from: @(#)exp.3	6.12 (Berkeley) 7/31/91
29.\" $FreeBSD: src/lib/msun/man/exp.3,v 1.24 2008/01/18 21:43:00 das Exp $
30.\"	$NetBSD: exp.3,v 1.33 2024/01/26 19:27:30 nros Exp $
31.\"
32.Dd January 24, 2024
33.Dt EXP 3
34.Os
35.Sh NAME
36.Nm exp ,
37.Nm expf ,
38.Nm expl ,
39.\" The sorting error is intentional.  exp and expf should be adjacent.
40.Nm exp2 ,
41.Nm exp2f ,
42.Nm exp2l ,
43.Nm expm1 ,
44.Nm expm1f
45.Nm expm1l
46.Nd exponential functions
47.Sh LIBRARY
48.Lb libm
49.Sh SYNOPSIS
50.In math.h
51.Ft double
52.Fn exp "double x"
53.Ft float
54.Fn expf "float x"
55.Ft long double
56.Fn expf "long double x"
57.Ft double
58.Fn exp2 "double x"
59.Ft float
60.Fn exp2f "float x"
61.Ft long double
62.Fn exp2l "long double x"
63.Ft double
64.Fn expm1 "double x"
65.Ft float
66.Fn expm1f "float x"
67.Ft long double
68.Fn expm1l "long double x"
69.Sh DESCRIPTION
70The
71.Fn exp ,
72.Fn expf ,
73and
74.Fn expl
75functions compute the base
76.Ms e
77exponential value of the given argument
78.Fa x .
79.Pp
80The
81.Fn exp2 ,
82.Fn exp2f ,
83and
84.Fn exp2l
85functions compute the base 2 exponential of the given argument
86.Fa x .
87.Pp
88The
89.Fn expm1 ,
90.Fn expm1f
91and
92.Fn expm1l
93functions compute the value exp(x)\-1 accurately even for tiny argument
94.Fa x .
95.Sh RETURN VALUES
96These functions will return the appropriate computation unless an error
97occurs or an argument is out of range.
98The functions
99.Fn exp
100and
101.Fn expm1
102detect if the computed value will overflow,
103set the global variable
104.Va errno
105to
106.Er ERANGE
107and cause a reserved operand fault on a
108.Tn VAX .
109.Sh SEE ALSO
110.Xr math 3
111.Sh STANDARDS
112The
113.Fn exp
114function conforms to
115.St -ansiC .
116The
117.Fn exp2 ,
118.Fn exp2f ,
119.Fn exp2l ,
120.Fn expf ,
121.Fn expl ,
122.Fn expm1 ,
123.Fn expm1f ,
124and
125.Fn expm1l
126functions conform to
127.St -isoC-99 .
128.Sh HISTORY
129The
130.Fn exp
131functions appeared in
132.At v1 .
133The
134.Fn expm1
135function appeared in
136.Bx 4.3 .
137