Skip to content

Commit

Permalink
* rational.c (nurat_cmp): use rb_num_coerce_cmp.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
tadf committed Jun 27, 2009
1 parent b2fb759 commit f94228c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Sat Jun 27 16:56:33 2009 Tadayoshi Funaba <[email protected]>

* rational.c (nurat_cmp): use rb_num_coerce_cmp.

Sat Jun 27 16:45:10 2009 Tadayoshi Funaba <[email protected]>

* complex.c: revised rdoc.
Expand Down
2 changes: 1 addition & 1 deletion rational.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ nurat_cmp(VALUE self, VALUE other)
return f_cmp(f_sub(num1, num2), ZERO);
}
default:
return rb_num_coerce_bin(self, other, id_cmp);
return rb_num_coerce_cmp(self, other, id_cmp);
}
}

Expand Down
3 changes: 3 additions & 0 deletions test/ruby/test_rational.rb
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,9 @@ def test_cmp
assert_equal(true, Rational(0) <= Rational(0))
assert_equal(true, Rational(0) >= Rational(0))
assert_equal(false, Rational(0) > Rational(0))

assert_equal(nil, Rational(0) <=> nil)
assert_equal(nil, Rational(0) <=> 'foo')
end

def test_equal
Expand Down

0 comments on commit f94228c

Please sign in to comment.