diff options
author | shigek <shigek@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-01 14:01:23 +0000 |
---|---|---|
committer | shigek <shigek@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-01 14:01:23 +0000 |
commit | 0967d72815617a13f10fed36f3d00535eb4fedb6 (patch) | |
tree | 7e182c56672b0252556292da7f605ff838b4099c /ext | |
parent | 81d1f5f866c0a795d0f0e85ae12080ee968825ae (diff) | |
download | ruby-0967d72815617a13f10fed36f3d00535eb4fedb6.tar.gz |
Bug in BigDecimal("1e#{n}").add BigDecimal('.5'),n) reported and fixed by Javier Goizueta.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 6a9940d335..0d339c9cfc 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -3788,10 +3788,9 @@ VpMidRound(Real *y, int f, int nf) } for(i=0;i<=n;++i) div *= 10; if(div>=BASE) { - y->frac[ix] = 0; if(ix) { - VpNmlz(y); - VpRdup(y,0); + y->frac[ix] = 0; + VpRdup(y,ix); } else { S_INT s = VpGetSign(y); VpSetOne(y); |