diff options
| author | g3xzh <g3xzh@yahoo.com> | 2013-12-12 01:57:13 +0200 |
|---|---|---|
| committer | g3xzh <g3xzh@yahoo.com> | 2013-12-19 02:13:51 +0200 |
| commit | 05395cba88580db10455952706cd8ae292fdbbe7 (patch) | |
| tree | 8a4b1b4a74b76aba35cd82834a835e252a362532 /src/rustllvm/RustWrapper.cpp | |
| parent | 4e0cb316fc980f00e1b74f3fdb7a842b540be280 (diff) | |
| download | rust-05395cba88580db10455952706cd8ae292fdbbe7.tar.gz rust-05395cba88580db10455952706cd8ae292fdbbe7.zip | |
Fix `sum()` accuracy
`[1e20, 1.0, -1e20].sum()` returns `0.0`. This happens because during the summation, `1.0` is too small relative to `1e20`, making it negligible. I have tried Kahan summation but it hasn't fixed the problem. Therefore, I've used Python's `fsum()` implementation with some help from Jason Fager and Huon Wilson. For more details, read: www.cs.cmu.edu/~quake-papers/robust-arithmetic.ps Moreover, benchmark and unit tests were added. Note: `Status.sum` is still not fully fixed. It doesn't handle NaNs, infinities and overflow correctly. See issue 11059: https://github.com/mozilla/rust/issues/11059
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
