Expand description
Complex numbers: a Complex<T> is re + im·i with parts of the Float type T, f32 or
f64.
They add with + and +=, subtract with - and -=, multiply with * and *= and divide
with / and /=, each operand owned or borrowed, and take a float of their own type as an
operand on either side. They negate with -, compare with ==, add up with Sum and multiply
with Product, and are written as 1+2i by Display.
Complex::abs and Complex::arg give the polar form, Complex::from_polar builds a
number from it, and Complex::conj, Complex::norm_sqr and Complex::recip the rest
of the arithmetic. Complex::exp, Complex::ln, Complex::sqrt, Complex::powi,
Complex::powf and Complex::powc are the principal values, with the branch cut of the
logarithm and the square root along the negative real axis, where the sign of a zero imaginary
part picks the side, as in C99’s <complex.h>.
Structs§
- Complex
- The complex number
re + im·i.