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

Fix Number.prototype.toExponential() value rounding #4169

Open
HalidOdat opened this issue Feb 20, 2025 · 0 comments
Open

Fix Number.prototype.toExponential() value rounding #4169

HalidOdat opened this issue Feb 20, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@HalidOdat
Copy link
Member

HalidOdat commented Feb 20, 2025

Describe the bug

The output is incorrect when rounding with 5 as the last digit.

(25).toExponential(0), // Should return "3e+1", actual "2e+1"
(12345).toExponential(3) // Should return "1.235e+4", actual "1.234e+4"

This cause the last built-in Number test262 test to fail: https://github.com/tc39/test262/blob/main/test/built-ins/Number/prototype/toExponential/return-values.js

Already have the issue in the ryu-js crate boa-dev/ryu-js#31, just leaving this issue to avoid duplicate work, trying to fix the hacky solution with format! 😅

@HalidOdat HalidOdat added the bug Something isn't working label Feb 20, 2025
@HalidOdat HalidOdat self-assigned this Feb 20, 2025
@HalidOdat HalidOdat moved this to In Progress in Boa pre-v1 Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

1 participant