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 | 950b57ca84adfaef27962892a8fd98914393d0f7 (patch) | |
tree | 7e182c56672b0252556292da7f605ff838b4099c /ext/bigdecimal | |
parent | 2a0eb711e39f35c45894354beeb63f71b2418ab1 (diff) | |
download | ruby-950b57ca84adfaef27962892a8fd98914393d0f7.tar.gz ruby-950b57ca84adfaef27962892a8fd98914393d0f7.tar.xz ruby-950b57ca84adfaef27962892a8fd98914393d0f7.zip |
Bug in BigDecimal("1e#{n}").add BigDecimal('.5'),n) reported and fixed by Javier Goizueta.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal')
-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 6a9940d33..0d339c9cf 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); |