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