xref: /freebsd/lib/msun/man/cexp.3 (revision bc7512cc58af2e8bbe5bbf5ca0059b1daa1da897)
1.\" Copyright (c) 2011 David Schultz <das@FreeBSD.org>
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.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd November 3, 2021
28.Dt CEXP 3
29.Os
30.Sh NAME
31.Nm cexp ,
32.Nm cexpf ,
33.Nm cexpl
34.Nd complex exponential functions
35.Sh LIBRARY
36.Lb libm
37.Sh SYNOPSIS
38.In complex.h
39.Ft double complex
40.Fn cexp "double complex z"
41.Ft float complex
42.Fn cexpf "float complex z"
43.Ft long double complex
44.Fn cexpl "long double complex z"
45.Sh DESCRIPTION
46The
47.Fn cexp ,
48.Fn cexpf ,
49and
50.Fn cexpl
51functions compute the complex exponential of
52.Fa z ,
53also known as
54.Em cis Ns ( Ns
55.Fa z Ns ) .
56.Sh RETURN VALUES
57For real numbers
58.Fa x
59and
60.Fa y ,
61.Fn cexp
62behaves according to Euler's formula:
63.Bd -ragged -offset indent
64.Fn cexp "x + I*y"
65=
66.Po Sy e Ns ** Ns
67.Fa x *
68.Em cos Ns Po Ns
69.Fa y Ns Pc Pc + Po Ns
70.Sy I
71*
72.Sy e Ns ** Ns
73.Fa x
74*
75.Em sin Ns Po Ns
76.Fa y Ns Pc Pc
77.Ed
78.Pp
79Generally speaking, infinities, zeroes and \*(Nas are handled as would
80be expected from this identity given the usual rules of floating-point
81arithmetic.
82However, care is taken to avoid generating \*(Nas when they are not deserved.
83For example, mathematically we expect that
84.Fo cimag
85.Fn cexp "x + I*0" Fc
86= 0 regardless of the value of
87.Fa x ,
88and
89.Fn cexp
90preserves this identity even if
91.Fa x
92is \*(If or \*(Na.
93Likewise,
94.Fn cexp "-\*(If + I*y"
95= 0 and
96.Fo creal
97.Fn cexp "\*(If + I*y" Fc
98= \*(If
99for any
100.Fa y
101(even though the latter property is only mathematically true for
102representable
103.Fa y . )
104If
105.Fa y
106is not finite, the sign of the result is indeterminate.
107.Sh SEE ALSO
108.Xr complex 3 ,
109.Xr exp 3 ,
110.Xr math 3
111.Sh STANDARDS
112The
113.Fn cexp ,
114.Fn cexpf ,
115and
116.Fn cexpl
117functions conform to
118.St -isoC-99 .
119