For real numbers
behaves according to Euler's formula:
cexp(x + I*y)
Generally speaking, infinities, zeroes and NaNs are handled as would
be expected from this identity given the usual rules of floating-point
However, care is taken to avoid generating NaNs when they are not deserved.
For example, mathematically we expect that
cimag(cexp(x + I*0))
= 0 regardless of the value of
preserves this identity even if
is ∞ or NaN.
cexp(-∞ + I*y)
= 0 and
creal(cexp(∞ + I*y))
(even though the latter property is only mathematically true for
is not finite, the sign of the result is indeterminate.