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

[GR-53531] Implement Math.sumPrecise #857

Open
fniephaus opened this issue Sep 26, 2024 · 0 comments
Open

[GR-53531] Implement Math.sumPrecise #857

fniephaus opened this issue Sep 26, 2024 · 0 comments
Assignees
Labels
proposal ECMAScript Proposals

Comments

@fniephaus
Copy link
Member

TL;DR

We plan to implement Math.sumPrecise in GraalJS.

Details

Add an iterable-taking Math.sumPrecise method which returns the sum of the values in the iterable using a more precise algorithm than naive summation.

Summing a list is a very common operation and is one of the few remaining use cases for Array.prototype.reduce. Better to let users express that operation directly.

Also, summing a list of floating point numbers can be done more precisely than the naive .reduce((a, b) => a + b, 0) approach using more clever algorithms, a fact which few JavaScript programmers are aware of (and even among those who are, most wouldn't bother doing it). We can make it easy to reach for the better option.

@fniephaus fniephaus added the proposal ECMAScript Proposals label Sep 26, 2024
@fniephaus fniephaus added this to the Planned for the Future milestone Sep 26, 2024
@fniephaus fniephaus moved this to Todo in GraalJS Roadmap Sep 26, 2024
@fniephaus fniephaus changed the title Implement Math.sumPrecise [GR-53531] Implement Math.sumPrecise Sep 26, 2024
@woess woess moved this from Todo to In Progress in GraalJS Roadmap Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal ECMAScript Proposals
Projects
Status: In Progress
Development

No branches or pull requests

3 participants