1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Native arbitrary-precision rational number type built on top of the
//! `oxinum_int::native` `BigInt` / `BigUint` foundation.
//!
//! Provides [`BigRational`], a value that is **always** kept in lowest terms
//! with a strictly positive denominator. The canonical zero is the unique
//! `{ num: 0, den: 1 }` representation, so `Eq`, `Hash`, and `Ord` are uniform.
//!
//! This module coexists with — and does NOT replace — the
//! [`dashu_ratio::RBig`] re-exports at the crate root.
//!
//! # Invariants
//!
//! Every public constructor and every arithmetic operation maintains:
//!
//! 1. `den > 0` (a zero denominator is reported as
//! [`OxiNumError::DivByZero`](oxinum_core::OxiNumError::DivByZero)).
//! 2. `gcd(|num|, den) == 1`.
//! 3. The canonical zero is exclusively `{ num: BigInt::ZERO, den: 1 }`.
//!
//! # Examples
//!
//! ```
//! use oxinum_rational::native::BigRational;
//! use oxinum_int::native::{BigInt, BigUint};
//!
//! // 6/4 auto-reduces to 3/2.
//! let r = BigRational::from_parts(BigInt::from(6i64), BigUint::from_u64(4))
//! .expect("non-zero denominator");
//! assert_eq!(r.to_string(), "3/2");
//!
//! // Sign always lives on the numerator: -9/12 reduces to -3/4.
//! let r = BigRational::from_parts(BigInt::from(-9i64), BigUint::from_u64(12))
//! .expect("non-zero denominator");
//! assert_eq!(r.to_string(), "-3/4");
//! ```
pub use ;
pub use BigRational;
pub use ParseBigRationalError;