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

Allow BigDecimal accept Float without precision #314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrzasa
Copy link
Contributor

@mrzasa mrzasa commented Feb 4, 2025

Make sure that conversion from a Float works consistently with the conversion from a string representing that float.

Current master state:

pry(main)> BigDecimal(1.2)
ArgumentError: can't omit precision for a Float.
from (pry):22:in `BigDecimal'
pry(main)> BigDecimal('1.2')
=> 0.12e1

After this changes:

pry(main)> BigDecimal(1.2)
=> 0.12e1
pry(main)> BigDecimal('1.2')
=> 0.12e1

When precision is omitted it's set to 0.

Fixes #213
Blocked by #313

@mrzasa mrzasa marked this pull request as ready for review February 4, 2025 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

BigDecimal should accept a Float value without a precision
1 participant