xref: /freebsd/lib/msun/man/cexp.3 (revision a3fb6da9ba05cbeeab1d5bec46075916256d2fb0)
1f3732b5aSDavid Schultz.\" Copyright (c) 2011 David Schultz <das@FreeBSD.org>
2f3732b5aSDavid Schultz.\" All rights reserved.
3f3732b5aSDavid Schultz.\"
4f3732b5aSDavid Schultz.\" Redistribution and use in source and binary forms, with or without
5f3732b5aSDavid Schultz.\" modification, are permitted provided that the following conditions
6f3732b5aSDavid Schultz.\" are met:
7f3732b5aSDavid Schultz.\" 1. Redistributions of source code must retain the above copyright
8f3732b5aSDavid Schultz.\"    notice, this list of conditions and the following disclaimer.
9f3732b5aSDavid Schultz.\" 2. Redistributions in binary form must reproduce the above copyright
10f3732b5aSDavid Schultz.\"    notice, this list of conditions and the following disclaimer in the
11f3732b5aSDavid Schultz.\"    documentation and/or other materials provided with the distribution.
12f3732b5aSDavid Schultz.\"
13f3732b5aSDavid Schultz.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14f3732b5aSDavid Schultz.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15f3732b5aSDavid Schultz.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16f3732b5aSDavid Schultz.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17f3732b5aSDavid Schultz.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18f3732b5aSDavid Schultz.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19f3732b5aSDavid Schultz.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20f3732b5aSDavid Schultz.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21f3732b5aSDavid Schultz.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22f3732b5aSDavid Schultz.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23f3732b5aSDavid Schultz.\" SUCH DAMAGE.
24f3732b5aSDavid Schultz.\"
25f3732b5aSDavid Schultz.\" $FreeBSD$
26f3732b5aSDavid Schultz.\"
27f3732b5aSDavid Schultz.Dd March 6, 2011
28f3732b5aSDavid Schultz.Dt CEXP 3
29f3732b5aSDavid Schultz.Os
30f3732b5aSDavid Schultz.Sh NAME
31f3732b5aSDavid Schultz.Nm cexp ,
32f3732b5aSDavid Schultz.Nm cexpf
33f3732b5aSDavid Schultz.Nd complex exponential functions
34f3732b5aSDavid Schultz.Sh LIBRARY
35f3732b5aSDavid Schultz.Lb libm
36f3732b5aSDavid Schultz.Sh SYNOPSIS
37f3732b5aSDavid Schultz.In complex.h
38f3732b5aSDavid Schultz.Ft double complex
39f3732b5aSDavid Schultz.Fn cexp "double complex z"
40f3732b5aSDavid Schultz.Ft float complex
41f3732b5aSDavid Schultz.Fn cexpf "float complex z"
42f3732b5aSDavid Schultz.Sh DESCRIPTION
43f3732b5aSDavid SchultzThe
44f3732b5aSDavid Schultz.Fn cexp
45f3732b5aSDavid Schultzand
46f3732b5aSDavid Schultz.Fn cexpf
47f3732b5aSDavid Schultzfunctions compute the complex exponential of
48f3732b5aSDavid Schultz.Fa z ,
49f3732b5aSDavid Schultzalso known as
50f3732b5aSDavid Schultz.Em cis Ns ( Ns
51*a3fb6da9SGlen Barber.Fa z Ns ) .
52f3732b5aSDavid Schultz.Sh RETURN VALUES
53f3732b5aSDavid SchultzFor real numbers
54f3732b5aSDavid Schultz.Fa x
55f3732b5aSDavid Schultzand
56f3732b5aSDavid Schultz.Fa y ,
57f3732b5aSDavid Schultz.Fn cexp
58f3732b5aSDavid Schultzbehaves according to Euler's formula:
59f3732b5aSDavid Schultz.Bd -ragged -offset indent
60f3732b5aSDavid Schultz.Fn cexp "x + I*y"
61f3732b5aSDavid Schultz=
62f3732b5aSDavid Schultz.Ns ( Sy e Ns ** Ns
63f3732b5aSDavid Schultz.Fa x *
64f3732b5aSDavid Schultz.Em cos Ns ( Ns
65f3732b5aSDavid Schultz.Fa y Ns )) + ( Ns
66f3732b5aSDavid Schultz.Sy I
67f3732b5aSDavid Schultz*
68f3732b5aSDavid Schultz.Sy e Ns ** Ns
69f3732b5aSDavid Schultz.Fa x
70f3732b5aSDavid Schultz*
71f3732b5aSDavid Schultz.Em sin Ns ( Ns
72f3732b5aSDavid Schultz.Fa y Ns ))
73f3732b5aSDavid Schultz.Ed
74f3732b5aSDavid Schultz.Pp
75f3732b5aSDavid SchultzGenerally speaking, infinities, zeroes and \*(Nas are handled as would
76f3732b5aSDavid Schultzbe expected from this identity given the usual rules of floating-point
77f3732b5aSDavid Schultzarithmetic.
78f3732b5aSDavid SchultzHowever, care is taken to avoid generating \*(Nas when they are not deserved.
79f3732b5aSDavid SchultzFor example, mathematically we expect that
80f3732b5aSDavid Schultz.Fo cimag
81f3732b5aSDavid Schultz.Fn cexp "x + I*0" Fc
82f3732b5aSDavid Schultz= 0 regardless of the value of
83f3732b5aSDavid Schultz.Fa x ,
84f3732b5aSDavid Schultzand
85f3732b5aSDavid Schultz.Fn cexp
86f3732b5aSDavid Schultzpreserves this identity even if
87f3732b5aSDavid Schultz.Fa x
88f3732b5aSDavid Schultzis \*(If or \*(Na.
89f3732b5aSDavid SchultzLikewise,
90f3732b5aSDavid Schultz.Fn cexp "-\*(If + I*y"
91f3732b5aSDavid Schultz= 0 and
92f3732b5aSDavid Schultz.Fo creal
93f3732b5aSDavid Schultz.Fn cexp "\*(If + I*y" Fc
94f3732b5aSDavid Schultz= \*(If
95f3732b5aSDavid Schultzfor any
96f3732b5aSDavid Schultz.Fa y
97f3732b5aSDavid Schultz(even though the latter property is only mathematically true for
98f3732b5aSDavid Schultzrepresentable
99f3732b5aSDavid Schultz.Fa y . )
100f3732b5aSDavid SchultzIf
101f3732b5aSDavid Schultz.Fa y
102f3732b5aSDavid Schultzis not finite, the sign of the result is indeterminate.
103f3732b5aSDavid Schultz.Sh SEE ALSO
104f3732b5aSDavid Schultz.Xr complex 3 ,
105f3732b5aSDavid Schultz.Xr exp 3 ,
106f3732b5aSDavid Schultz.Xr math 3 ,
107f3732b5aSDavid Schultz.Sh STANDARDS
108f3732b5aSDavid SchultzThe
109f3732b5aSDavid Schultz.Fn cexp
110f3732b5aSDavid Schultzand
111f3732b5aSDavid Schultz.Fn cexpf
112f3732b5aSDavid Schultzfunctions conform to
113f3732b5aSDavid Schultz.St -isoC-99 .
114