diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | numeric.c | 8 | ||||
-rw-r--r-- | version.h | 6 |
3 files changed, 12 insertions, 6 deletions
@@ -1,3 +1,7 @@ +Sat Jul 14 01:44:39 2007 Yukihiro Matsumoto <matz@ruby-lang.org> + + * numeric.c (int_pow): wrong overflow detection. [ruby-dev:31213] + Fri Jul 13 16:10:00 2007 Tanaka Akira <akr@fsij.org> * lib/open-uri.rb (URI::Generic#find_proxy): use ENV.to_hash to access @@ -2197,16 +2197,18 @@ int_pow(x, y) while (y % 2 == 0) { long x2 = x * x; if (x2 < x || !POSFIXABLE(x2)) { + VALUE v; bignum: - return rb_big_mul(rb_big_pow(rb_int2big(x), LONG2NUM(y)), - rb_int2big(neg ? -z : z)); + v = rb_big_pow(rb_int2big(x), LONG2NUM(y)); + if (z != 1) v = rb_big_mul(rb_int2big(neg ? -z : z), v); + return v; } x = x2; y >>= 1; } { long xz = x * z; - if (xz < z || xz < x || !POSFIXABLE(xz)) { + if (!POSFIXABLE(xz) || xz / x != z) { goto bignum; } z = xz; @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.6" -#define RUBY_RELEASE_DATE "2007-07-13" +#define RUBY_RELEASE_DATE "2007-07-14" #define RUBY_VERSION_CODE 186 -#define RUBY_RELEASE_CODE 20070713 +#define RUBY_RELEASE_CODE 20070714 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 6 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 7 -#define RUBY_RELEASE_DAY 13 +#define RUBY_RELEASE_DAY 14 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; |