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

Update documentation for Kernel#BigDecimal() digits argument [ci skip] #151

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

Conversation

jeremyevans
Copy link
Contributor

I expected this to affect the significant digits if providing
the first argument as a String, but it does not. I'm positive this
argument is ignored if the first argument is an Integer, but I'm
not positive that it is ignored if the first argument is a String,
as the value is passed to VpAlloc. However, if it has an effect,
I'm not sure what it is.

I expected this to affect the significant digits if providing
the first argument as a String, but it does not.  I'm positive this
argument is ignored if the first argument is an Integer, but I'm
not positive that it is ignored if the first argument is a String,
as the value is passed to VpAlloc. However, if it has an effect,
I'm not sure what it is.
* the number of significant digits is determined from the initial
* value.
* digits:: The number of significant digits, as an Integer. This is required if
* +initial+ is a Float or Rational, and ignored otherwise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 for digits has the special meaning that the number of significant digits is automatically determined from the given initial value. For a Rational initial value, for example, the resulting BigDecimal is determined on the value of BigDecimal.limit and the behavior of BigDecimal#div.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I wonder if there is a better way to word it. I want the documentation to explain that it does not have an effect in cases where you would expect it would:

BigDecimal(1.1234, 2)
# => 0.11e1
BigDecimal(Rational(11234,10000), 2)
# => 0.11e1
BigDecimal('1.1234', 2)
# => 0.11234e1

BigDecimal(11234.0, 2)
# => 0.11e5
BigDecimal(11234, 2)
# => 0.11234e5

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.

2 participants