scirs2_core/arithmetic/mod.rs
1//! Extended precision arithmetic for scientific computing.
2//!
3//! This module provides double-double arithmetic (~31 decimal digits of precision)
4//! using error-free transformations (EFTs) based on Dekker/Knuth algorithms.
5//!
6//! # Overview
7//!
8//! | Type | Description |
9//! |------|-------------|
10//! | [`DoubleDouble`] | Double-double floating-point number (hi + lo) |
11//!
12//! # Functions
13//!
14//! | Function | Description |
15//! |----------|-------------|
16//! | [`dot_dd`] | Accumulated dot product in double-double precision |
17//! | [`sum_dd`] | Compensated summation (Ogita-Rump-Oishi) |
18//!
19//! # Example
20//!
21//! ```rust
22//! use scirs2_core::arithmetic::{DoubleDouble, sum_dd};
23//!
24//! // Catastrophic cancellation handled correctly
25//! let values = [1.0_f64, 1e100, 1.0, -1e100];
26//! let result = sum_dd(&values);
27//! assert!((result.to_f64() - 2.0).abs() < 1e-10);
28//! ```
29
30pub mod double_double;
31
32pub use double_double::{dot_dd, sum_dd, DoubleDouble};