Project

General

Profile

Bug #5515

Integer#quo(aFloat) の結果が Rational になる

Added by tadf (tadayoshi funaba) almost 8 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 2.0.0dev (2011-10-30 trunk 33566) [i686-linux]
Backport:
[ruby-dev:44710]

Description

Integer#quo(aFloat) の結果が Rational になる。

5.quo(2.0) #=> (5/2)

1.9.2 では Float になります。


Related issues

Related to Ruby master - Bug #8894: Fixnum#quo returns wrong result when given a floatClosedActions

Associated revisions

Revision febc42d0
Added by mrkn (Kenta Murata) over 6 years ago

  • numeric.c (num_quo): should return a Float for a Float argument.
    [ruby-dev:44710] [Bug #5515]

  • test/ruby/test_fixnum.rb: Add an assertion for the above change.

  • test/ruby/test_bignum.rb: ditto.

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

Revision 41099
Added by mrkn (Kenta Murata) over 6 years ago

  • numeric.c (num_quo): should return a Float for a Float argument.
    [ruby-dev:44710] [Bug #5515]

  • test/ruby/test_fixnum.rb: Add an assertion for the above change.

  • test/ruby/test_bignum.rb: ditto.

Revision 41099
Added by mrkn (Kenta Murata) over 6 years ago

  • numeric.c (num_quo): should return a Float for a Float argument.
    [ruby-dev:44710] [Bug #5515]

  • test/ruby/test_fixnum.rb: Add an assertion for the above change.

  • test/ruby/test_bignum.rb: ditto.

Revision 41099
Added by mrkn (Kenta Murata) over 6 years ago

  • numeric.c (num_quo): should return a Float for a Float argument.
    [ruby-dev:44710] [Bug #5515]

  • test/ruby/test_fixnum.rb: Add an assertion for the above change.

  • test/ruby/test_bignum.rb: ditto.

Revision 41099
Added by mrkn (Kenta Murata) over 6 years ago

  • numeric.c (num_quo): should return a Float for a Float argument.
    [ruby-dev:44710] [Bug #5515]

  • test/ruby/test_fixnum.rb: Add an assertion for the above change.

  • test/ruby/test_bignum.rb: ditto.

Revision 41099
Added by mrkn (Kenta Murata) over 6 years ago

  • numeric.c (num_quo): should return a Float for a Float argument.
    [ruby-dev:44710] [Bug #5515]

  • test/ruby/test_fixnum.rb: Add an assertion for the above change.

  • test/ruby/test_bignum.rb: ditto.

Revision 41099
Added by mrkn (Kenta Murata) over 6 years ago

  • numeric.c (num_quo): should return a Float for a Float argument.
    [ruby-dev:44710] [Bug #5515]

  • test/ruby/test_fixnum.rb: Add an assertion for the above change.

  • test/ruby/test_bignum.rb: ditto.

History

Updated by ko1 (Koichi Sasada) over 7 years ago

  • Category set to core
  • Assignee set to mrkn (Kenta Murata)
#2

Updated by shyouhei (Shyouhei Urabe) over 7 years ago

  • Status changed from Open to Assigned
#3

Updated by mrkn (Kenta Murata) over 6 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r41099.
tadayoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • numeric.c (num_quo): should return a Float for a Float argument.
    [ruby-dev:44710] [Bug #5515]

  • test/ruby/test_fixnum.rb: Add an assertion for the above change.

  • test/ruby/test_bignum.rb: ditto.

Updated by tadf (tadayoshi funaba) about 6 years ago

  • Status changed from Closed to Open
  • Priority changed from Normal to 5
  • Target version deleted (Next Major)

直ってないみたい。
そもそも r28844 で間違った事してて、trunk でも表面的に対処してるだけだった。

Updated by tadf (tadayoshi funaba) about 6 years ago

$ ruby -v -e 'p 5.quo(2.0)'
ruby 2.0.0p317 (2013-09-15 revision 42947) i686-linux

Updated by naruse (Yui NARUSE) about 6 years ago

  • Status changed from Open to Assigned
  • Target version set to 2.1.0

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

  • Status changed from Assigned to Closed

Also available in: Atom PDF