View source code
Display the source code in std/complex.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.complex.expi

Complex!(real) expi (
  real y
) pure nothrow @nogc @trusted;

Parameters

NameDescription
y A real number.

Returns

The value of cos(y) + i sin(y).

Note

expi is included here for convenience and for easy migration of code that uses std.math.expi. Unlike std.math.expi, which uses the x87 fsincos instruction when possible, this function is no faster than calculating cos(y) and sin(y) separately.

Example

import std.math : cos, sin;
writeln(expi(0.0L)); // 1.0L
writeln(expi(1.3e5L)); // complex(cos(1.3e5L), sin(1.3e5L))

Authors

Lars Tandle Kyllingstad, Don Clugston

License

Boost License 1.0