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

Implement exact summation (fsum)? #152

Closed
4 tasks done
Fil opened this issue Jun 15, 2020 · 1 comment · Fixed by #154
Closed
4 tasks done

Implement exact summation (fsum)? #152

Fil opened this issue Jun 15, 2020 · 1 comment · Fixed by #154
Assignees

Comments

@Fil
Copy link
Member

Fil commented Jun 15, 2020

Discussed with Kahan summation (#33, #149), fsum is a bit slower but provably "exact" and would be the preferred "exact summation" algorithm for d3-array.

I've implemented it in https://observablehq.com/d/723090bd2ef54f5f ; it does not return a sum but an object that can be used to continue the sum by adding more terms.

  • speed test (about 2x slower than d3.sum which is not that bad)
  • a valueof accessor
  • check if this implementation is useful in d3-geo.
  • document
@Fil Fil self-assigned this Jun 15, 2020
This was referenced Jun 15, 2020
@Fil
Copy link
Member Author

Fil commented Jun 17, 2020

Good news: replacing d3-geo/adder with fsum can help solve https://observablehq.com/@fil/small-circle-test by enhancing the precision of the sums.

Fil added a commit that referenced this issue Jun 23, 2020
exact summation of IEEE 754 numbers
fixes #152 (see also #33)
@Fil Fil mentioned this issue Jun 23, 2020
@Fil Fil closed this as completed in #154 Jul 30, 2020
Fil added a commit that referenced this issue Jul 30, 2020
* d3.fsum / d3.Adder
exact summation of IEEE 754 numbers
fixes #152 (see also #33)

Co-authored-by: Mike Bostock <mbostock@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant