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

tonumber produces wrong results for large exponents #788

Closed
XmiliaH opened this issue Dec 26, 2021 · 1 comment
Closed

tonumber produces wrong results for large exponents #788

XmiliaH opened this issue Dec 26, 2021 · 1 comment

Comments

@XmiliaH
Copy link

XmiliaH commented Dec 26, 2021

Large exponents in numbers are cut of by

if (xx < 65536) xx = xx * 10 + (*p & 15);
without handling the cut. This can result in wrong numbers as is the case in

print(tonumber("0." .. string.rep("0", 99999) .. "1e100000"))
print(tonumber("0." .. string.rep("0", 999999) .. "1e1000000"))

where the second number should be 1 but is calculated as 0.

@MikePall
Copy link
Member

Fixed. Thanks!

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

No branches or pull requests

2 participants