Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Further optimize Math.rint using a floating point splitting technique. #5200

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

Merged
merged 1 commit into from
Jun 21, 2025

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Jun 20, 2025

Benchmarks show that this is markedly faster than the previous implementation. That is unsurprising, as the js.Math.round algorithm basically had to handle x.5 values twice on top of the primitive hardware rounding function (once inside js.Math.round to turn ties-to-even into ties-up; and once in our algorithm to turn ties-up back to ties-to-even).

Benchmarks show that this is markedly faster than the previous
implementation. That is unsurprising, as the `js.Math.round`
algorithm basically had to handle x.5 values *twice* on top of
the primitive hardware rounding function (once inside
`js.Math.round` to turn ties-to-even into ties-up; and once in
our algorithm to turn ties-up back to ties-to-even).
@sjrd sjrd requested a review from gzm0 June 20, 2025 08:42
@gzm0 gzm0 merged commit a970e8f into scala-js:main Jun 21, 2025
3 checks passed
@sjrd sjrd deleted the math-rint-splitting branch June 21, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants