1
* numeric.c (fix_plus): addition in Fixnum will never overflow
2
long. a patch from Ondrej Bilka <neleai at seznam.cz>.
4
* numeric.c (fix_minus): ditto.
5
* bignum.c (rb_big_pow): eagerly truncate resulting bignum.
8
diff -ruN ruby-1.8.5.orig/bignum.c ruby-1.8.5/bignum.c
9
--- ruby-1.8.5.orig/bignum.c 2006-04-10 01:10:36.000000000 +0900
10
+++ ruby-1.8.5/bignum.c 2006-09-19 14:44:51.000000000 +0900
15
- $Date: 2006/04/09 16:10:36 $
16
+ $Date: 2006/09/09 15:27:34 $
17
created at: Fri Jun 10 00:48:55 JST 1994
19
Copyright (C) 1993-2003 Yukihiro Matsumoto
20
@@ -1206,15 +1206,8 @@
26
- * big * other => Numeric
28
- * Multiplies big and other, returning the result.
37
@@ -1257,7 +1250,21 @@
47
+ * big * other => Numeric
49
+ * Multiplies big and other, returning the result.
56
+ return bignorm(rb_big_mul0(x, y));
60
@@ -1616,9 +1623,11 @@
64
- x = rb_big_mul(x, x);
65
+ x = rb_big_mul0(x, x);
66
+ if (!BDIGITS(x)[RBIGNUM(x)->len-1]) RBIGNUM(x)->len--;
68
- z = rb_big_mul(z, x);
69
+ z = rb_big_mul0(z, x);
70
+ if (!BDIGITS(z)[RBIGNUM(z)->len-1]) RBIGNUM(z)->len--;
74
diff -ruN ruby-1.8.5.orig/numeric.c ruby-1.8.5/numeric.c
75
--- ruby-1.8.5.orig/numeric.c 2006-05-01 12:46:46.000000000 +0900
76
+++ ruby-1.8.5/numeric.c 2006-09-19 14:44:51.000000000 +0900
77
@@ -1982,11 +1982,8 @@
84
- if (FIX2LONG(r) != c) {
85
- r = rb_big_plus(rb_int2big(a), rb_int2big(b));
89
if (TYPE(y) == T_FLOAT) {
90
@@ -2015,11 +2012,8 @@
97
- if (FIX2LONG(r) != c) {
98
- r = rb_big_minus(rb_int2big(a), rb_int2big(b));
102
if (TYPE(y) == T_FLOAT) {