General

Profile

rgburger (Robert Burger)

  • Login: rgburger
  • Registered on: 08/26/2026
  • Last sign in: 08/28/2026

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 0 0 0

Activity

08/28/2026

11:19 PM Ruby Bug #22246: Rational#to_f incorrectly rounds when the numerator is a bignum that cannot be represented exactly by a double, and the denominator is a fixnum
I found two more cases where `rb_big_fdiv_double` produces an incorrectly rounded result. I added them to [pull request #18599](https://github.com/ruby/ruby/pull/18559).
```Ruby
assert_equal(3.333333333333333e39, (10**40).fdiv(3), "Bug...
rgburger (Robert Burger)

08/27/2026

06:03 PM Ruby Bug #22246: Rational#to_f incorrectly rounds when the numerator is a bignum that cannot be represented exactly by a double, and the denominator is a fixnum
Here's an example of Rational#to_f giving an incorrect result when the numerator is a bignum and the denominator is a fixnum that can't be exactly represented as a double:
`Rational(10**24, 10**17 + 9).to_f` should return 10000000.0, but...
rgburger (Robert Burger)
01:57 PM Ruby Bug #22246: Rational#to_f incorrectly rounds when the numerator is a bignum that cannot be represented exactly by a double, and the denominator is a fixnum
Consider the related code in `fix_fdiv_double`, which demonstrates a check for the denominator y being a fixnum that's exactly represented by a double.
```
static double
fix_fdiv_double(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
...
rgburger (Robert Burger)
01:13 PM Ruby Bug #22246: Rational#to_f incorrectly rounds when the numerator is a bignum that cannot be represented exactly by a double, and the denominator is a fixnum
This bug is not related to Feature #21308 except for the same author. The implementation of Rational#to_f does not perform any base conversions.
The bug is caused by the assumption that a floating-point conversion of a bignum numerator ...
rgburger (Robert Burger)

Also available in: Atom