Bug #5515

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

Added by tadayoshi funaba almost 4 years ago. Updated over 1 year ago.

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

Description

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

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

1.9.2 では Float になります。


Related issues

Related to Ruby trunk - Bug #8894: Fixnum#quo returns wrong result when given a float Open 09/11/2013

Associated revisions

Revision 41099
Added by Kenta Murata about 2 years ago

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

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

  • test/ruby/test_bignum.rb: ditto.

Revision 41099
Added by Kenta Murata about 2 years ago

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

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

  • test/ruby/test_bignum.rb: ditto.

History

#1 Updated by Koichi Sasada over 3 years ago

  • Assignee set to Kenta Murata
  • Category set to core

#2 Updated by Shyouhei Urabe over 3 years ago

  • Status changed from Open to Assigned

#3 Updated by Kenta Murata about 2 years ago

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

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.
    [Bug #5515]

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

  • test/ruby/test_bignum.rb: ditto.

#4 Updated by tadayoshi funaba almost 2 years ago

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

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

#5 Updated by tadayoshi funaba almost 2 years ago

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

#6 Updated by Yui NARUSE almost 2 years ago

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

#7 Updated by Nobuyoshi Nakada over 1 year ago

  • Status changed from Assigned to Closed

Also available in: Atom PDF