Project

General

Profile

Actions

Bug #14712

closed

test_step does not work for implementations with full 64-bit fixnum

Added by headius (Charles Nutter) over 6 years ago. Updated over 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:86684]

Description

In test/ruby/test_numeric.rb, in test_step, there's the following logic:

assert_operator((0.0).step(bignum.to_f, 1.0).size, :>=, bignum) # may loose precision

where bignum is

bignum = RbConfig::LIMITS['FIXNUM_MAX'] + 1

This test passes in both CRuby and JRuby when using CRuby's "smallest bignum" value of 4611686018427387904.

This test fails in both CRuby and JRuby when using JRuby's "smallest bignum" value of 9223372036854775809.

The failure in JRuby is the same as in CRuby:

$ rvm ruby-2.5 do ruby test/mri/runner.rb test/mri/ruby/test_numeric.rb -n test_step
Run options: -n test_step

# Running tests:

[1/1] TestNumeric#test_step = 0.00 s
  1) Failure:
TestNumeric#test_step [/Users/headius/projects/jruby/test/mri/ruby/test_numeric.rb:292]:
Expected 9223372036854775808 to be >= 9223372036854775809.

Since we (JRuby) use CRuby's tests largely unmodified, I'd like this one to run successfully. However, hardcoding to the CRuby value would mean we aren't testing the same things (since that value would use fixnum logic), so I'm not sure the best way to improve this test.

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r63261.


test_numeric.rb: loose precision assertion

  • test/ruby/test_numeric.rb (TestNumeric#test_step): remove a
    loose precision assertion, as Float cannot keep complete
    precision. [ruby-core:86684] [Bug #14712]
Actions

Also available in: Atom PDF

Like0
Like0