Re:High Performance Correctly Rounded Math Libraries for 32-...
by a1369209993 on Thursday August 26, 2021 @04:26PM
(#28320205)
Kahan summation is basically just synthesizing a larger floating point type (with 46/106 bits of mantissa for 32/64-bit base type) and then using that to do the sum, though. You still lose precision if your errors exceed that new, larger margin. Eg try adding 34000 + 56 + .078 - 56 - 34000, carrying two digits per float.
Re:High Performance Correctly Rounded Math Libraries for 32-...
by adgjlsfhk1 on Thursday August 26, 2021 @04:14PM
(#28320056)
One thing to consider here is XSum. It's a C library that has surprisingly fast exact floating point sums.
EDIT: Apparently there's a nice Rust crate for doing this stuff: https://crates.io/crates/accurate
[1] https://en.wikipedia.org/wiki/Kahan_summation_algorithm#Alte...