xref: /freebsd/lib/msun/man/cexp.3 (revision 02e9120893770924227138ba49df1edb3896112a)
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.Dd November 3, 2021
26.Dt CEXP 3
27.Os
28.Sh NAME
29.Nm cexp ,
30.Nm cexpf ,
31.Nm cexpl
32.Nd complex exponential functions
33.Sh LIBRARY
34.Lb libm
35.Sh SYNOPSIS
36.In complex.h
37.Ft double complex
38.Fn cexp "double complex z"
39.Ft float complex
40.Fn cexpf "float complex z"
41.Ft long double complex
42.Fn cexpl "long double complex z"
43.Sh DESCRIPTION
44The
45.Fn cexp ,
46.Fn cexpf ,
47and
48.Fn cexpl
49functions compute the complex exponential of
50.Fa z ,
51also known as
52.Em cis Ns ( Ns
53.Fa z Ns ) .
54.Sh RETURN VALUES
55For real numbers
56.Fa x
57and
58.Fa y ,
59.Fn cexp
60behaves according to Euler's formula:
61.Bd -ragged -offset indent
62.Fn cexp "x + I*y"
63=
64.Po Sy e Ns ** Ns
65.Fa x *
66.Em cos Ns Po Ns
67.Fa y Ns Pc Pc + Po Ns
68.Sy I
69*
70.Sy e Ns ** Ns
71.Fa x
72*
73.Em sin Ns Po Ns
74.Fa y Ns Pc Pc
75.Ed
76.Pp
77Generally speaking, infinities, zeroes and \*(Nas are handled as would
78be expected from this identity given the usual rules of floating-point
79arithmetic.
80However, care is taken to avoid generating \*(Nas when they are not deserved.
81For example, mathematically we expect that
82.Fo cimag
83.Fn cexp "x + I*0" Fc
84= 0 regardless of the value of
85.Fa x ,
86and
87.Fn cexp
88preserves this identity even if
89.Fa x
90is \*(If or \*(Na.
91Likewise,
92.Fn cexp "-\*(If + I*y"
93= 0 and
94.Fo creal
95.Fn cexp "\*(If + I*y" Fc
96= \*(If
97for any
98.Fa y
99(even though the latter property is only mathematically true for
100representable
101.Fa y . )
102If
103.Fa y
104is not finite, the sign of the result is indeterminate.
105.Sh SEE ALSO
106.Xr complex 3 ,
107.Xr exp 3 ,
108.Xr math 3
109.Sh STANDARDS
110The
111.Fn cexp ,
112.Fn cexpf ,
113and
114.Fn cexpl
115functions conform to
116.St -isoC-99 .
117