Skip to main content

Module arithmetic

Module arithmetic 

Source
Expand description

Extended precision arithmetic for scientific computing.

This module provides double-double arithmetic (~31 decimal digits of precision) using error-free transformations (EFTs) based on Dekker/Knuth algorithms.

§Overview

TypeDescription
DoubleDoubleDouble-double floating-point number (hi + lo)

§Functions

FunctionDescription
dot_ddAccumulated dot product in double-double precision
sum_ddCompensated summation (Ogita-Rump-Oishi)

§Example

use scirs2_core::arithmetic::{DoubleDouble, sum_dd};

// Catastrophic cancellation handled correctly
let values = [1.0_f64, 1e100, 1.0, -1e100];
let result = sum_dd(&values);
assert!((result.to_f64() - 2.0).abs() < 1e-10);

Re-exports§

pub use double_double::dot_dd;
pub use double_double::sum_dd;
pub use double_double::DoubleDouble;

Modules§

double_double
Double-double arithmetic (~31 decimal digits of precision).