about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-12-18 18:41:35 -0800
committerbors <bors@rust-lang.org>2013-12-18 18:41:35 -0800
commitb4ed6f969592595cf821bf9f72b015185a56b4f0 (patch)
tree2fc477e92708e68fca4d3555c70bb1c5efcfbc38 /src/rustllvm/RustWrapper.cpp
parent3c2c13bae4783c808f6640286d41cba6d9394dd9 (diff)
parent05395cba88580db10455952706cd8ae292fdbbe7 (diff)
downloadrust-b4ed6f969592595cf821bf9f72b015185a56b4f0.tar.gz
rust-b4ed6f969592595cf821bf9f72b015185a56b4f0.zip
auto merge of #10927 : g3xzh/rust/sum_bugfix, r=huonw
`[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.
For more details, read:
www.cs.cmu.edu/~quake-papers/robust-arithmetic.ps
https://github.com/mozilla/rust/issues/10851

Python's fsum (msum)
http://code.activestate.com/recipes/393090/

@huonw, your feedback is more than welcome.
It looks unpolished; Do you have suggestions how to make it more beautiful and elegant?

Thanks in advance,
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions