Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DECFLOAT. Implement high-accuracy algorithm for SUM of values with exponenta greater than 34. [CORE6242] #6486

Open
firebird-automations opened this issue Feb 2, 2020 · 2 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Attachments:
neumaier-klein-builin_sum_-_results_comparison.sql

As described here: https://en.wikipedia.org/wiki/Kahan_summation_algorithm - there is several ways to reduce accumulation of round errors during make SUM operation.
Consider script from attach and its results.
There is only one test case (column "test_no" = 1) which contains proper values in all thee columns: SUM() as it is implemented now, Neumaier and Klein-Kahan totalling. But these values has exponenta less than 34.
All other test cases contain at least one wrong result.
The best accuracy is demonstrated by Klein-Kahan algorithm, but is also has one flaw: example where test_no = 5 (proper results there must be exactly 0).

It will be useful to have alternate implementation for SUM() ( say, "SUM2()" ?) which will use some of algorithm with compensation of running totals.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

Attachment: neumaier-klein-builin_sum_-_results_comparison.sql [ 13420 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

description: As described here: https://en.wikipedia.org/wiki/Kahan_summation_algorithm - there is several ways to reduce accumulation of round errors during make SUM operation.
Consider script from attach and its results.
There is only one test case (column "test_no" = 1) which contains proper values in all thee columns: SUM() as it is implemented now, Neumaier and Klein-Kahan totalling. But these values has exponenta less than 34.
All other test cases contain at least one wrong result.
The best accuracy is demonstrated by Klein-Kahan algorithm, but is also has one flaw: example where test_no = 5 (proper results there must be exactly 0).

It will be useful to have alternate implementation for SUM() ( say, "SUM2()" ?) which will use some of algorithm with compensation of running totals.

=>

As described here: https://en.wikipedia.org/wiki/Kahan_summation_algorithm - there is several ways to reduce accumulation of round errors during make SUM operation.
Consider script from attach and its results.
There is only one test case (column "test_no" = 1) which contains proper values in all thee columns: SUM() as it is implemented now, Neumaier and Klein-Kahan totalling. But these values has exponenta less than 34.
All other test cases contain at least one wrong result.
The best accuracy is demonstrated by Klein-Kahan algorithm, but is also has one flaw: example where test_no = 5 (proper results there must be exactly 0).

It will be useful to have alternate implementation for SUM() ( say, "SUM2()" ?) which will use some of algorithm with compensation of running totals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant