summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-30 08:43:28 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-30 08:43:28 +0000
commit54d534f04313a0437a613516169cb243b695ccaf (patch)
tree04fc0c8f6e436dbe5025298e3d61851252820e27 /bignum.c
parent864bc4f18beb189c07a22e605810bb8d6eef5645 (diff)
* string.c (rb_str_chomp_bang): do smart chomp if $/ == '\n'.
* io.c (rb_io_puts): don't treat Array specially. * bignum.c (rb_big_cmp): should convert bignum to float. * eval.c (rb_f_eval): can't modify untainted binding. * regex.c (re_compile_pattern): should preverve p0 value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index 2a1601bf5b..cbb0699209 100644
--- a/bignum.c
+++ b/bignum.c
@@ -561,7 +561,13 @@ rb_big_cmp(x, y)
break;
case T_FLOAT:
- y = dbl2big(RFLOAT(y)->value);
+ {
+ double d = rb_big2dbl(x);
+
+ if (d == RFLOAT(y)->value) return INT2FIX(0);
+ if (d > RFLOAT(y)->value) return INT2FIX(1);
+ if (d < RFLOAT(y)->value) return INT2FIX(-1);
+ }
break;
default: