Project

General

Profile

Bug #14712

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

Added by headius (Charles Nutter) 9 months ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
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.

Associated revisions

Revision b7d260f1
Added by nobu (Nobuyoshi Nakada) 9 months ago

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 63261
Added by nobu (Nobuyoshi Nakada) 9 months ago

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]

Revision 63261
Added by nobu (Nobuyoshi Nakada) 9 months ago

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]

History

#1

Updated by nobu (Nobuyoshi Nakada) 9 months 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]

Also available in: Atom PDF