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

Weird behavior 1_000_000_000.12345.to_d in bigdecimal 3.0.1 #192

Closed
kamipo opened this issue May 3, 2021 · 1 comment · Fixed by #203
Closed

Weird behavior 1_000_000_000.12345.to_d in bigdecimal 3.0.1 #192

kamipo opened this issue May 3, 2021 · 1 comment · Fixed by #203
Assignees
Labels

Comments

@kamipo
Copy link

kamipo commented May 3, 2021

I've found weird behavior in bigdecimal 3.0.1 when I was testing rails/rails#42125.

Expected behavior

1_000_000_000.12345.to_d #=> 0.100000000012345e10
1.000_000_000_12345.to_d #=> 0.100000000012345e1

Actual behavior

1_000_000_000.12345.to_d #=> 0.1e10
1.000_000_000_12345.to_d #=> 0.1e1
2.0.2 3.0.0 3.0.1
1_000_000_000.12345.to_d 0.100000000012345e10 0.100000000012345e10 0.1e10 (!?)
1_000_000_0001.2345.to_d 0.100000000012345e11 0.100000000012345e11 0.100000000012345e11
1_000_000_00012.345.to_d 0.100000000012345e12 0.100000000012345e12 0.100000000012345e12
1_000_000_000123.45.to_d 0.100000000012345e13 0.100000000012345e13 0.100000000012345e13
1_000_000_0001234.5.to_d 0.100000000012345e14 0.100000000012345e14 0.100000000012345e14
@mrkn
Copy link
Member

mrkn commented May 3, 2021

Thank you for the report. I couldn't remember the bugs including this are remaining in the master branch before releasing 3.0.1. 🤦

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

Successfully merging a pull request may close this issue.

2 participants