Issue #13674 has been updated by mrkn (Kenta Murata).

Status changed from Open to Assigned
Assignee set to mrkn (Kenta Murata)

----------------------------------------
Bug #13674: BigDecimal comparison with Float::INFINITY is erroneous in 2.2.x and 2.3.x
https://bugs.ruby-lang.org/issues/13674#change-66337

* Author: Eregon (Benoit Daloze)
* Status: Assigned
* Priority: Normal
* Assignee: mrkn (Kenta Murata)
* Target version: 
* ruby -v: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
* Backport: 2.2: REQUIRED, 2.3: REQUIRED, 2.4: DONTNEED
----------------------------------------
    BigDecimal("-0.2E5556") > -Float::INFINITY

returns wrong results in MRI 2.2.x and 2.3.x:

    for ruby in 2.0.0-p647 2.1.7 2.2.3 2.2.6 2.2.7 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 trunk; do chruby $ruby; ruby -v -rbigdecimal -e 'p BigDecimal("-0.2E5556") > -Float::INFINITY'; done
    ruby 2.0.0p647 (2015-08-18) [x86_64-linux]
    -e:1:in `to_r': -Infinity (FloatDomainError)
        from -e:1:in `>'
        from -e:1:in `<main>'
    ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
    -e:1:in `to_r': -Infinity (FloatDomainError)
        from -e:1:in `>'
        from -e:1:in `<main>'

    ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
    -e:1:in `to_r': -Infinity (FloatDomainError)
        from -e:1:in `>'
        from -e:1:in `<main>'

    ruby 2.2.6p396 (2016-11-15 revision 56800) [x86_64-linux]
    false
    ruby 2.2.7p470 (2017-03-28 revision 58194) [x86_64-linux]
    false

    ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
    -e:1:in `to_r': -Infinity (FloatDomainError)
        from -e:1:in `>'
        from -e:1:in `<main>'
    ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
    -e:1:in `to_r': -Infinity (FloatDomainError)
        from -e:1:in `>'
        from -e:1:in `<main>'

    ruby 2.3.2p217 (2016-11-15 revision 56796) [x86_64-linux]
    false
    ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
    false
    ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux]
    false

    ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
    true
    ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
    true
    ruby 2.5.0dev (2017-06-13 trunk 59075) [x86_64-linux]
    true

This was discovered by ruby/specs added in JRuby in https://github.com/jruby/jruby/pull/4618.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>