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 each MRI version I've tried, I am able to convert a high-precision BigDecimal to a reasonably similar Rational value. For instance, in MRI 2.4.1:
require 'bigdecimal' # => true BigDecimal.new("3.141592653589793238462643383279502884197169").to_r # => (3141592653589793238462643383279502884197169/1000000000000000000000000000000000000000000) _.to_f # => 3.141592653589793
require 'bigdecimal' # => true BigDecimal.new("3.141592653589793238462643383279502884197169").to_r # => (448798950512827605494663340468500412028167/1317624576693539401) _.to_f # => 3.4061215800865547e+23
I'd expect something in the region of 3.14 here, but instead, the result is approximately 340 sextillion.
Rational(high_precision_pi)
high_precision_pi.to_s.to_r
The text was updated successfully, but these errors were encountered:
using double -> long cast easily causes an inaccurate denominator
ccc4923
resolves jruby#4711
eebf5a5
Yeah, this is pretty wacky. Looks like @kares is looking into it.
Sorry, something went wrong.
b7aaa1b
kares
No branches or pull requests
Environment
Expected Behavior
In each MRI version I've tried, I am able to convert a high-precision BigDecimal to a reasonably similar Rational value. For instance, in MRI 2.4.1:
Actual Behavior
I'd expect something in the region of 3.14 here, but instead, the result is approximately 340 sextillion.
Other info
Rational(high_precision_pi)
, toohigh_precision_pi.to_s.to_r
.The text was updated successfully, but these errors were encountered: