math::complex+x86_64 +linux

math::complex provides functions for working with complex floating-point numbers.

Index

Types

type c128 = (f64, f64);
type c64 = (f32, f32);
type complex = (c64 | c128);

Functions

fn absc128(z: c128) f64;
fn acosc128(z: c128) c128;
fn acoshc128(z: c128) c128;
fn addc128(a: c128, b: c128) c128;
fn addc64(a: c64, b: c64) c64;
fn argc128(z: c128) f64;
fn asinc128(z: c128) c128;
fn asinhc128(z: c128) c128;
fn atanc128(x: c128) c128;
fn atanhc128(x: c128) c128;
fn c128to64(z: c128) c64;
fn c64to128(z: c64) c128;
fn conjc128(z: c128) c128;
fn conjc64(z: c64) c64;
fn cosc128(z: c128) c128;
fn coshc128(z: c128) c128;
fn divc128(a: c128, b: c128) c128;
fn divc64(a: c64, b: c64) c64;
fn equal(a: complex, b: complex) bool;
fn equalc128(a: c128, b: c128) bool;
fn equalc64(a: c64, b: c64) bool;
fn expc128(z: c128) c128;
fn isinf(z: c128) bool;
fn isnan(z: c128) bool;
fn logc128(z: c128) c128;
fn mulc128(a: c128, b: c128) c128;
fn mulc64(a: c64, b: c64) c64;
fn negc128(z: c128) c128;
fn negc64(z: c64) c64;
fn polarc128(z: c128) (f64, f64);
fn powc128(a: c128, b: c128) c128;
fn projc128(z: c128) c128;
fn projc64(z: c64) c64;
fn rectc128(r: f64, theta: f64) c128;
fn sinc128(z: c128) c128;
fn sinhc128(z: c128) c128;
fn sqrtc128(z: c128) c128;
fn subc128(a: c128, b: c128) c128;
fn subc64(a: c64, b: c64) c64;
fn tanc128(x: c128) c128;
fn tanhc128(x: c128) c128;

Types

type c128[permalink] [source]

type c128 = (f64, f64);

A complex number containing a real component and an imaginary component, represented as two double-precision floating point numbers.

type c64[permalink] [source]

type c64 = (f32, f32);

A complex number containing a real component and an imaginary component, represented as two single-precision floating point numbers.

type complex[permalink] [source]

type complex = (c64 | c128);

A tagged union of all complex types.

Functions

fn absc128[permalink] [source]

fn absc128(z: c128) f64;

Takes the absolute value of a complex number.

fn acosc128[permalink] [source]

fn acosc128(z: c128) c128;

Returns the arccosine, in radians, of z.

fn acoshc128[permalink] [source]

fn acoshc128(z: c128) c128;

Returns the inverse hyperbolic cosine of z.

fn addc128[permalink] [source]

fn addc128(a: c128, b: c128) c128;

Adds two complex numbers.

fn addc64[permalink] [source]

fn addc64(a: c64, b: c64) c64;

Adds two complex numbers

fn argc128[permalink] [source]

fn argc128(z: c128) f64;

Gets the argument, or phase, of a complex number.

fn asinc128[permalink] [source]

fn asinc128(z: c128) c128;

Returns the arcsine, in radians, of z.

fn asinhc128[permalink] [source]

fn asinhc128(z: c128) c128;

Returns the inverse hyperbolic sine of z.

fn atanc128[permalink] [source]

fn atanc128(x: c128) c128;

Returns the inverse tangent of x.

fn atanhc128[permalink] [source]

fn atanhc128(x: c128) c128;

Returns the inverse hyperbolic tangent of x.

fn c128to64[permalink] [source]

fn c128to64(z: c128) c64;

Truncates a c128 to a c64. Precision may be lost.

fn c64to128[permalink] [source]

fn c64to128(z: c64) c128;

Converts a c64 to a c128.

fn conjc128[permalink] [source]

fn conjc128(z: c128) c128;

Takes the conjugate of a complex number by negating the imaginary component.

fn conjc64[permalink] [source]

fn conjc64(z: c64) c64;

Takes the conjugate of a complex number by negating the imaginary component.

fn cosc128[permalink] [source]

fn cosc128(z: c128) c128;

Returns the cosine of z, in radians.

fn coshc128[permalink] [source]

fn coshc128(z: c128) c128;

Returns the hyperbolic cosine of z.

fn divc128[permalink] [source]

fn divc128(a: c128, b: c128) c128;

Divides two complex numbers.

fn divc64[permalink] [source]

fn divc64(a: c64, b: c64) c64;

Divides two complex numbers.

fn equal[permalink] [source]

fn equal(a: complex, b: complex) bool;

Checks if two complex numbers are equal. Be sure to take floating point round-off errors into account.

fn equalc128[permalink] [source]

fn equalc128(a: c128, b: c128) bool;

Checks if two complex numbers are equal. Be sure to take floating point round-off errors into account.

fn equalc64[permalink] [source]

fn equalc64(a: c64, b: c64) bool;

Checks if two complex numbers are equal. Be sure to take floating point round-off errors into account.

fn expc128[permalink] [source]

fn expc128(z: c128) c128;

Returns math::E raised to the power of z.

fn isinf[permalink] [source]

fn isinf(z: c128) bool;

Returns true if the given complex number is infinite.

fn isnan[permalink] [source]

fn isnan(z: c128) bool;

Returns true if the given complex number is NaN -- that is -- either component is NaN and neither component is an infinity.

fn logc128[permalink] [source]

fn logc128(z: c128) c128;

Returns the natural logarithm of z.

fn mulc128[permalink] [source]

fn mulc128(a: c128, b: c128) c128;

Multiplies two complex numbers.

fn mulc64[permalink] [source]

fn mulc64(a: c64, b: c64) c64;

Multiplies two complex numbers.

fn negc128[permalink] [source]

fn negc128(z: c128) c128;

Negates z.

fn negc64[permalink] [source]

fn negc64(z: c64) c64;

Negates z.

fn polarc128[permalink] [source]

fn polarc128(z: c128) (f64, f64);

Returns the polar coordinates of z.

fn powc128[permalink] [source]

fn powc128(a: c128, b: c128) c128;

Returns a raised to the power of b.

fn projc128[permalink] [source]

fn projc128(z: c128) c128;

Projects z onto the surface of a Riemann Sphere. If z is finite, it projects to itself. If z is infinite, it projects to positive infinity on the real axis.

fn projc64[permalink] [source]

fn projc64(z: c64) c64;

Projects z onto the surface of a Riemann Sphere. If z is finite, it projects to itself. If z is infinite, it projects to positive infinity on the real axis.

fn rectc128[permalink] [source]

fn rectc128(r: f64, theta: f64) c128;

Creates a new c128 from the polar coordinates (r, theta).

fn sinc128[permalink] [source]

fn sinc128(z: c128) c128;

Returns the sine of z, in radians.

fn sinhc128[permalink] [source]

fn sinhc128(z: c128) c128;

Returns the hyperbolic sine of z.

fn sqrtc128[permalink] [source]

fn sqrtc128(z: c128) c128;

Returns the square root of z.

fn subc128[permalink] [source]

fn subc128(a: c128, b: c128) c128;

Subtracts two complex numbers.

fn subc64[permalink] [source]

fn subc64(a: c64, b: c64) c64;

Subtracts two complex numbers.

fn tanc128[permalink] [source]

fn tanc128(x: c128) c128;

Returns the tangent of x.

fn tanhc128[permalink] [source]

fn tanhc128(x: c128) c128;

Returns the hyperbolic tangent of x.