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