C complex.h cexp,cexpf and cexpl


The C <complex.h> cexp,cexpf and cexpl function compute the base-e exponential of the complex number.The declaration of the function is given below.

1 double complex cexp(double complex z);
2 float complex cexpf(float complex z);
3 long double complex cexpl(long double complex z);

All the three functions compute the same value,the only difference between them is in their return type:

i)The ‘cexp’ return the base-e exponential of complex as double complex type.
ii)The ‘cexpf’ return the base-e exponential of complex as float complex type and
iii)The ‘cexpl’ return the base-e exponential of complex as long double complex type.

Note the functions cexp(z) or cexpf(z) or cexpl(z) is same as computing ez.

double complex cexp(double complex z);

Parameters:
z – A complex number whose base-e exponential is to be computed.

Return type
double complex -The complex base-e expoenetial of ‘z’ as double type.

Code example

double complex c1=16.3 +I*10.2 , c2 ;

c2=cexp( c1 ) ;

printf( “Real part of c2=%lf”, creal(c2) ) ;
printf( “\nImaginary part of c2=%lf”, cimag(c2) ) ;

Output in Code::Blocks,

real part of c2=-8567612.604177
Imaginary part of c2=-8394993.064208

Link : C complex.h creal,crealf and creall
Link : C complex.h cimag,cimagf and cimagl



float complex cexpf(float complex z);

This function return the base-e exponential as float type.

Parameters:
z – A complex number whose base-e exponential is to be computed.

Return type
float complex -The complex base-e expoenetial of ‘z’ as float type.

Code example

float complex c1=16.3 +I*10.2 , c2 ;

c2=cexpf( c1 ) ;

printf( “Real part of c2=%f”, crealf(c2) ) ;
printf( “\nImaginary part of c2=%f”, cimagf(c2) ) ;

Output, Code::Blocks,

real part of c2=-8567607.000000
Imaginary part of c2=-8394985.000000


long double complex cexpl(long double complex z);

This function return the base-e exponential as long double type.

Parameters:
z – A complex number whose base-e exponential is to be computed.

Return type
long double complex -The complex base-e expoenetial of ‘z’ as long double type.

Code example

long double complex c1=16.3 +I*10.2 , c2 ;

c2=cexpl( c1 ) ;

printf( “Real part of c2=%Lf”, creall(c2) ) ;
printf( “\nImaginary part of c2=%Lf”, cimagl(c2) ) ;

Output, Code::Blocks,

real part of c2=-8567607.000000
Imaginary part of c2=-8394985.000000


*Side Note

Some facts about cexp,cexpf and cexpl ,

  ➥cexp(conj(z))=conj(cexp(z)).

  ➥cexp(±0 + i0) returns 1+i0.

  ➥cexp(x + i∞) returns NaN+iNaN and raises the invalid floating-point exception, for finite x.

  ➥cexp(x + iNaN) returns NaN+iNaN and optionally raises the invalid floating-point exception, for finite x.

  ➥cexp(+∞ + i0) returns +∞+i0.

  ➥cexp(−∞+iy) returns -0 -i0, for finite y.

  ➥cexp(+∞ +iy) returns -∞ -∞, for finite nonzero y.

  ➥cexp(−∞ + i∞) returns ±0±i0 (where the signs of the real and imaginary parts of the result are unspecified).

  ➥cexp(+∞ + i∞) returns ±∞+iNaN and raises the in valid floating-point exception (where the sign of the real part of the result is unspecified).

  ➥cexp(−∞ + iNaN) returns ±0±i0 (where the signs of the real and imaginary parts of the result are unspecified).

  ➥cexp(+∞ + iNaN) returns ±∞+iNaN (where the sign of the real part of the result is unspecified).

  ➥cexp(NaN + i0) returns NaN+i0.

  ➥cexp(NaN + iy) returns NaN+iNaN and optionally raises the in valid floating-point exception, for all nonzero numbers y.

  ➥cexp(NaN + iNaN) returns NaN+iNaN.

Link :C complex.h conj,conjf and conjl