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