3 ms·
Are you referring to https://en.wikipedia.org/wiki/Kahan_summation_algorithm https://en.wikipedia.org/wiki/Kahan_summation_algorithm by any chance? If this is
by bluestreak 7y ago
Are you referring to https://en.wikipedia.org/wiki/Kahan_summation_algorithm https://en.wikipedia.org/wiki/Kahan_summation_algorithm by any chance?
If this is the case - we can easily implement this algorithm.
- zbjornson 7y agoThere are several accurate summation algorithms; Kahan is one of them. Looks like Postgresql uses an accurate summation method[0] (and not Kahan), so that's probably a big factor in why theirs is so much slower and also makes for an unfair comparison. FWIW I posted AVX2 and AVX512 Kahan summation implementations here[1]. [0] https://github.com/postgres/postgres/blob/3ed2005ff595d349276e5b2edeca1a8100b08c87/src/backend/utils/adt/float.c#L2723 https://github.com/postgres/postgres/blob/3ed2005ff595d34927... [1] http://blog.zachbjornson.com/2019/08/11/fast-float-summation.html http://blog.zachbjornson.com/2019/08/11/fast-float-summation...
- bluestreak 7y agoThank you Zach, this is super interesting and useful! I wonder why PG do not use Kahan?