Search
View source code
Display the source code in std/complex.d from which this page was generated on github.
Report a bug
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.

# Module `std.complex`

This module contains the `Complex` type, which is used to represent complex numbers, along with related mathematical operations and functions.

`Complex` will eventually replace the built-in types `cfloat`, `cdouble`, `creal`, `ifloat`, `idouble`, and `ireal`.

## Functions

NameDescription
``` abs(z) ```
``` acos(z) ``` Inverse trigonometric functions on complex numbers.
``` acosh(z) ``` Inverse hyperbolic trigonometric functions on complex numbers.
``` arg(z) ```
``` asin(z) ``` Inverse trigonometric functions on complex numbers.
``` asinh(z) ``` Inverse hyperbolic trigonometric functions on complex numbers.
``` atan(z) ``` Inverse trigonometric functions on complex numbers.
``` atanh(z) ``` Inverse hyperbolic trigonometric functions on complex numbers.
``` complex(re) ``` Helper function that returns a complex number with the specified real and imaginary parts.
``` conj(z) ```
``` cos(z) ``` Trigonometric functions on complex numbers.
``` cosh(z) ``` Hyperbolic trigonometric functions on complex numbers.
``` coshisinh(y) ```
``` exp(x) ``` Calculates ex.
``` expi(y) ```
``` fromPolar(modulus, argument) ``` Constructs a complex number given its absolute value and argument.
``` log(x) ``` Calculate the natural logarithm of x. The branch cut is along the negative axis.
``` log10(x) ``` Calculate the base-10 logarithm of x.
``` norm(z) ``` Extracts the norm of a complex number.
``` pow(x, n) ``` Calculates xn. The branch cut is on the negative axis.
``` proj(z) ``` Returns the projection of `z` onto the Riemann sphere.
``` sin(z) ``` Trigonometric functions on complex numbers.
``` sinh(z) ``` Hyperbolic trigonometric functions on complex numbers.
``` sqAbs(z) ```
``` sqrt(z) ```
``` tan(z) ``` Trigonometric functions on complex numbers.
``` tanh(z) ``` Hyperbolic trigonometric functions on complex numbers.

## Structs

NameDescription
``` Complex ``` A complex number parametrised by a type `T`, which must be either `float`, `double` or `real`.