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

round(), int() returns incorrect value #2057

Closed
volzhs opened this issue Jun 9, 2015 · 2 comments
Closed

round(), int() returns incorrect value #2057

volzhs opened this issue Jun 9, 2015 · 2 comments

Comments

@volzhs
Copy link
Contributor

volzhs commented Jun 9, 2015

print(round(123456.0), ",", round(123456789.0), ",", round(1234567890.0))
print(int(123456.0), ",", int(123456789.0), ",", int(1234567890.0))

both cases prints 123456,123456792,1234567936

@choikwa
Copy link
Contributor

choikwa commented Jun 9, 2015

sounds like precision issue. My guess is underneath implementation uses single-precision.

@akien-mga
Copy link
Member

Yes like @choikwa says, I guess it's a matter of using single precision for floats, and thus numbers with 10 significant digits like your second one show precision issues.

See #288 for a request to add double precision support.

I'll close the issue as I believe it's not a bug but just a consequence of #288 not being solvd yet, though feel free to tell me if you think this is not the appropriate resolution.

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

3 participants