1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/bigdecimal/bigdecimal.c (VpCtoV): fix to check overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-05-06 19:28:12 +00:00
parent 8db2aa1216
commit 54476a6024
3 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Fri May 7 03:40:58 2010 NARUSE, Yui <naruse@ruby-lang.org>
* ext/bigdecimal/bigdecimal.c (VpCtoV): fix to check overflow.
Thu May 6 22:19:38 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* cont.c: define FIBER_USE_NATIVE only when _WIN32_WINNT >= 0x0400

View file

@ -4033,9 +4033,9 @@ VpCtoV(Real *a, const char *int_chr, U_LONG ni, const char *frac, U_LONG nf, con
while(i < me) {
es = e*((S_INT)BASE_FIG);
e = e * 10 + exp_chr[i] - '0';
if(es>e*((S_INT)BASE_FIG)) {
if(es > (S_INT)(e*BASE_FIG)) {
exponent_overflow = 1;
e = es;
e = es; /* keep sign */
break;
}
++i;

View file

@ -25,6 +25,7 @@ class TestBigDecimal < Test::Unit::TestCase
assert_equal( 1, BigDecimal.new("Infinity").infinite?)
assert_equal(-1, BigDecimal.new("-Infinity").infinite?)
assert_equal(true, BigDecimal.new("NaN").nan?)
assert_equal( 1, BigDecimal.new("1E11111111111").infinite?)
end
def _test_mode(type)