#floating-point #sum #dot-product

accurate

(more or less) accurate floating point algorithms

4 releases (2 breaking)

Uses old Rust 2015

0.3.1 Oct 12, 2020
0.3.0 Apr 14, 2018
0.2.1 Mar 18, 2016
0.1.1 Feb 28, 2016

#659 in Algorithms

Download history 2689/week @ 2023-10-23 2729/week @ 2023-10-30 3256/week @ 2023-11-06 3076/week @ 2023-11-13 3438/week @ 2023-11-20 2642/week @ 2023-11-27 3146/week @ 2023-12-04 3136/week @ 2023-12-11 2803/week @ 2023-12-18 1048/week @ 2023-12-25 2472/week @ 2024-01-01 2820/week @ 2024-01-08 2479/week @ 2024-01-15 2143/week @ 2024-01-22 2145/week @ 2024-01-29 2692/week @ 2024-02-05

9,569 downloads per month
Used in 43 crates (3 directly)

MIT/Apache

55KB
1K SLoC

(More or less) accurate floating point algorithms

Travis build status Documentation: hosted License: Apache License 2.0 or MIT latest GitHub release crate on crates.io

This crate provides several algorithms that implement highly accurate or even guaranteed correct sum and dot product for floating-point numbers without resorting to arbitrary precision arithmetic. These algorithms are available:

Usage

Add the accurate crate as a dependency in your Cargo.toml:

[dependencies]
accurate = "0.3"

Then use it in your program like this:

extern crate accurate;

use accurate::traits::*;
use accurate::sum::Sum2;

fn main() {
  let x = vec![1.0, 2.0, 3.0];
  let s = x.sum_with_accumulator::<Sum2<_>>();
  assert_eq!(6.0f64, s);
}

Documentation

Documentation for the latest version of the crate is on docs.rs.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~175–490KB