From 448b4eb117bf4d53f5cc6fde2490ccd1c084da11 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 19 Mar 2016 12:53:36 +0000 Subject: fix r54193 * numeric.c (fix_cmp): invert the result as the comarison is inverted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index 53af5c5666..38e05b6292 100644 --- a/numeric.c +++ b/numeric.c @@ -3425,7 +3425,12 @@ fix_cmp(VALUE x, VALUE y) return INT2FIX(-1); } else if (RB_TYPE_P(y, T_BIGNUM)) { - return rb_big_cmp(y, x); + VALUE cmp = rb_big_cmp(y, x); + switch (cmp) { + case INT2FIX(+1): return INT2FIX(-1); + case INT2FIX(-1): return INT2FIX(+1); + } + return cmp; } else if (RB_TYPE_P(y, T_FLOAT)) { return rb_integer_float_cmp(x, y); -- cgit v1.2.3