We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
headius
Learn more about funding links in repositories.
Report abuse
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
In CRuby >= 2.1, both Fixnum and Bignum have #bit_length method. (Reference of Ruby 2.1 Bignum)
Fixnum
Bignum
#bit_length
On the other hand, JRuby 9.0.x implements only Fixnum#bit_length, Bignum#bit_length is not implemented.
Fixnum#bit_length
Bignum#bit_length
Java's BigInteger has bitLength method, so it can be polyfilled, but lacking CRuby's method is a problem.
BigInteger
bitLength
# Polyfill code class Bignum def bit_length to_java.bitLength end end
p (2**1000).respond_to?(:bit_length) # => true p (2**1000).bit_length # => 1001
p (2**1000).respond_to?(:bit_length) # => false p (2**1000).bit_length # => raises NoMethodError
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In CRuby >= 2.1, both
Fixnum
andBignum
have#bit_length
method. (Reference of Ruby 2.1Bignum
)On the other hand, JRuby 9.0.x implements only
Fixnum#bit_length
,Bignum#bit_length
is not implemented.Java's
BigInteger
hasbitLength
method, so it can be polyfilled, but lacking CRuby's method is a problem.Environment
Expected Behavior
Actual Behavior
The text was updated successfully, but these errors were encountered: