std::exp(std::complex)
Defined in header <complex> | ||
|---|---|---|
template< class T > complex<T> exp( const complex<T>& z ); |
Compute base-e exponential of z, that is e (Euler's number, 2.7182818) raised to the z power.
Parameters
| z | - | complex value |
Return value
If no errors occur, e raised to the power of z, ez
, is returned.
Error handling and special values
Errors are reported consistent with math_errhandling.
If the implementation supports IEEE floating-point arithmetic,
-
std::exp(std::conj(z)) == std::conj(std::exp(z)) - If
zis(±0,+0), the result is(1,+0) - If
zis(x,+∞)(for any finite x), the result is(NaN,NaN)andFE_INVALIDis raised. - If
zis(x,NaN)(for any finite x), the result is(NaN,NaN)andFE_INVALIDmay be raised. - If
zis(+∞,+0), the result is(+∞,+0) - If
zis(-∞,y)(for any finite y), the result is+0cis(y) - If
zis(+∞,y)(for any finite nonzero y), the result is+∞cis(y) - If
zis(-∞,+∞), the result is(±0,±0)(signs are unspecified) - If
zis(+∞,+∞), the result is(±∞,NaN)andFE_INVALIDis raised (the sign of the real part is unspecified) - If
zis(-∞,NaN), the result is(±0,±0)(signs are unspecified) - If
zis(+∞,NaN), the result is(±∞,NaN)(the sign of the real part is unspecified) - If
zis(NaN,+0), the result is(NaN,+0) - If
zis(NaN,y)(for any nonzero y), the result is(NaN,NaN)andFE_INVALIDmay be raised - If
zis(NaN,NaN), the result is(NaN,NaN)
where cis(y) is cos(y) + i sin(y).
Notes
The complex exponential function ez
for z = x+iy equals ex
cis(y), or, ex
(cos(y) + i sin(y)).
The exponential function is an entire function in the complex plane and has no branch cuts.
Example
#include <complex>
#include <iostream>
int main()
{
const double pi = std::acos(-1);
const std::complex<double> i(0, 1);
std::cout << std::fixed << " exp(i*pi) = " << std::exp(i * pi) << '\n';
}Output:
exp(i*pi) = (-1.000000,0.000000)
See also
| complex natural logarithm with the branch cuts along the negative real axis (function template) |
|
|
(C++11)(C++11) | returns e raised to the given power (ex) (function) |
applies the function std::exp to each element of valarray (function template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/numeric/complex/exp