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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Native arbitrary-precision floating-point implementation.
//!
//! This module provides [`BigFloat`], a binary-base (`b = 2`) arbitrary
//! precision floating-point number with explicit precision tracking and
//! post-operation rounding. It is implemented in pure safe Rust on top of
//! the native [`oxinum_int::native::BigUint`] limb-vector integer.
//!
//! The wrapper-level [`crate::BigFloat`] alias (decimal-base `DBig` via
//! `dashu-float`) is a separate type — they coexist intentionally. Reach
//! for the native `BigFloat` when you need ground-up Pure Rust binary
//! arithmetic with explicit rounding-mode control.
//!
//! # Phase 2 scope (this module)
//!
//! - Construction / decomposition: `zero`, `nan`, `infinity`, `neg_infinity`,
//! `from_i64`, `from_f64`, `to_f64`, `from_parts`, `with_precision`,
//! `round_to_precision`.
//! - Accessors: `precision`, `sign`, `mantissa`, `exponent`, `is_zero`,
//! `is_finite`, `is_infinite`, `is_nan`, `is_normal`, `classify`,
//! `is_sign_positive`, `is_sign_negative`, `signum`, `abs`, `neg`.
//! - Classification: `FloatClass` enum (`Finite`, `Infinite`, `Nan`).
//! - Arithmetic: `Add`, `Sub`, `Neg`, plus the `*Assign` variants.
//! - Comparison: `PartialOrd`, `PartialEq` (precision-independent, NaN-aware).
//! **Note:** `Ord` and `Eq` are *not* implemented — NaN breaks reflexivity
//! and totality. Use `BigFloat::total_cmp` for a sort-stable total order.
//! - Display: hex-float-like `0xb<binary>p<exponent>`, `NaN`, `inf`, `-inf`.
//!
//! Multiplication, division, and square root land in `float_mul`,
//! `float_div`, and `float_sqrt`. They feed back through
//! [`BigFloat::from_parts`] so the canonical-form invariants are uniformly
//! enforced.
//!
//! # Examples
//!
//! ```
//! use oxinum_float::native::{BigFloat, RoundingMode};
//!
//! let one = BigFloat::from_i64(1, 32, RoundingMode::HalfEven);
//! let two = BigFloat::from_i64(2, 32, RoundingMode::HalfEven);
//! let sum = &one + &two;
//! assert_eq!(sum.to_f64(), 3.0);
//!
//! let three = BigFloat::from_i64(3, 32, RoundingMode::HalfEven);
//! let six = &two * &three;
//! assert_eq!(six.to_f64(), 6.0);
//! ```
pub use ;
pub use FloatContext;
pub use ;
pub use ParseBigFloatError;