Skip to main content

Crate oxinum_complex

Crate oxinum_complex 

Source
Expand description

Arbitrary-precision complex arithmetic for the OxiNum ecosystem.

Provides CBig, a complex number whose real and imaginary parts are each a DBig (decimal arbitrary-precision float re-exported from oxinum_float). Everything is Pure Rust — no GMP, no MPFR, no C/C++ — so the type works unchanged on every platform the rest of the COOLJAPAN stack targets.

CBig is the high-level, decimal-backed front end. For a ground-up binary-base complex built directly on oxinum_float::native::BigFloat with explicit rounding-mode control, see native::BigComplex.

§Layout

A CBig is the ordered pair (re, im) representing re + im·i. The two components are independent DBig values and may carry different precisions; arithmetic and transcendental routines (added by sibling modules) reconcile precision as needed.

§Why Hash, Eq, and Ord are not implemented

  • No Ord / PartialOrd. The complex field is not ordered: there is no order relation compatible with the ring structure, so any total order would be arbitrary and mathematically misleading. Callers who need a sort key should compare on a derived scalar (e.g. magnitude or the lexicographic (re, im) pair) explicitly.
  • No Hash / Eq. CBig is built from DBig, which deliberately does not implement core::hash::Hash (distinct representations can compare equal across precisions, mirroring the IEEE-754 reasons f32/f64 skip Hash in the standard library). PartialEq is provided (component-wise) where useful, but a lawful Eq/Hash pair would require a canonicalisation policy that varies by use case.

§Examples

use oxinum_complex::CBig;

let z = CBig::from_f64(3.0, 4.0).expect("finite parts");
// |3 + 4i|^2 = 9 + 16 = 25
assert_eq!(z.norm_sqr().to_string(), "25");

Modules§

native
Native binary-base arbitrary-precision complex implementation built on oxinum_float::native::BigFloat.

Structs§

CBig
Arbitrary-precision complex number re + im·i, with each component a decimal DBig.

Enums§

OxiNumError
Errors from OxiNum operations.

Type Aliases§

Complex
Convenience alias for CBig, mirroring the BigFloat = DBig convention used throughout the OxiNum crates.
DBig
Multi-precision float number with decimal exponent and HalfAway rounding mode
OxiNumResult
Convenience alias for Result<T, OxiNumError>.