Crates.io | accurate |
lib.rs | accurate |
version | 0.3.1 |
source | src |
created_at | 2016-02-28 16:16:17.177887 |
updated_at | 2020-10-12 19:58:50.356357 |
description | (more or less) accurate floating point algorithms |
homepage | https://github.com/bsteinb/accurate |
repository | https://github.com/bsteinb/accurate |
max_upload_size | |
id | 4322 |
size | 109,313 |
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:
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 for the latest version of the crate is on docs.rs.
Licensed under either of
at your option.
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.