3 ms·
Use doubles, use Kahan summation, use 2Sum algo, use larger precision floating point library?
by DeathArrow 2y ago
Use doubles, use Kahan summation, use 2Sum algo, use larger precision floating point library?
- janwas 2y ago+1 for TwoSum [1]. To expand on that: Kahan summation is an approximation which is a bit cheaper, but not great if some inputs can also be negative. That's because it is basically FastTwoSum(a,b) in a loop, which only works if the exponent of a >= that of b. TwoSum removes this requirement and is not that much more expensive. [1] https://en.wikipedia.org/wiki/2Sum https://en.wikipedia.org/wiki/2Sum