diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-11 14:37:47 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-11 14:37:47 +0000 |
commit | 2fed0e8e6f5d4a194e1dfcb39ef29a4a08cfa4ec (patch) | |
tree | dbf98e5297fd1e907a0f49ad7d74e88e266f99bc /ext | |
parent | 79c3f54d784ea814be8e4163e8b13deff02ff12d (diff) |
merge revision(s) 20228:
* ext/bigdecimal/bigdecimal.c (VpMidRound): Round method bug
pointed by Ryan Platte fixed(Patch to the patch from "NATORI
Shin"). [ruby-talk:273360]
back ported from 1.9. fix [ruby-core:19791]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@22243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 636c0907d6..7400b313a4 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -4345,6 +4345,11 @@ VpMidRound(Real *y, int f, int nf) nf += y->exponent*((int)BASE_FIG); exptoadd=0; if (nf < 0) { + /* rounding position too left(large). */ + if((f!=VP_ROUND_CEIL) && (f!=VP_ROUND_FLOOR)) { + VpSetZero(y,VpGetSign(y)); /* truncate everything */ + return 0; + } exptoadd = -nf; nf = 0; } |