diff options
author | shigek <shigek@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-05 09:31:36 +0000 |
---|---|---|
committer | shigek <shigek@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-05 09:31:36 +0000 |
commit | 12fd558cf3e625cd7077e24cf6b4ea9c839ea9de (patch) | |
tree | a93ec31dca649e366fbc1ab794af03207dd874b0 /ext/bigdecimal | |
parent | 32fd8835866d73bfd349bbb68db63cdebcda4ceb (diff) | |
download | ruby-12fd558cf3e625cd7077e24cf6b4ea9c839ea9de.tar.gz ruby-12fd558cf3e625cd7077e24cf6b4ea9c839ea9de.tar.xz ruby-12fd558cf3e625cd7077e24cf6b4ea9c839ea9de.zip |
Trailing 0s in to_s removed. & Bug in VpFrac fixed.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index edfa65be1..4f747e292 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -3208,6 +3208,7 @@ VpToString(Real *a,char *psz,int fFmt) --ex; n /= 10; } + while(psz[-1]=='0') *(--psz) = 0; sprintf(psz, "E%ld", ex); } else { if(VpIsPosZero(a)) sprintf(psz, "0.0"); @@ -3845,6 +3846,7 @@ VpFrac(Real *y, Real *x) VpAsgn(y, x, 1); goto Exit; } + y->Prec = x->Prec -(U_LONG) x->exponent; y->Prec = Min(y->Prec, y->MaxPrec); y->exponent = 0; @@ -3852,11 +3854,12 @@ VpFrac(Real *y, Real *x) ind_y = 0; my = y->Prec; ind_x = x->exponent; - while(ind_y <= my) { + while(ind_y < my) { y->frac[ind_y] = x->frac[ind_x]; ++ind_y; ++ind_x; } + VpNmlz(y); Exit: #ifdef _DEBUG |