Skip to content

[Bug]: A problem about rounding double precision floating point numbers #7014

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

Open
ayuan0828 opened this issue Feb 27, 2025 · 2 comments
Open
Labels

Comments

@ayuan0828
Copy link

ChakraCore Version

36becec

Steps to reproduce

When I use the 'print()' method to output an array containing a specific double-precision floating-point number, there is an unexpected rounding error in the last digit. Should the binary representation of the value be stored accurately?

Proof of concept

const testNumber = 9.758231785433683;
const numberArray = [testNumber];
print(numberArray);

Exception or Error

9.758231785433682

Additional Context

No response

@ayuan0828 ayuan0828 added the Bug label Feb 27, 2025
@Owaiseimdad
Copy link

@ayuan0828 this is because of small rounding error. Where in the code we are using the above example and relying on more than 10th precision?

@ayuan0828
Copy link
Author

It was discovered during use and I was just a little curious as to why ChakraCore was implemented this way.

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

No branches or pull requests

2 participants