summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorshigek <shigek@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-05 09:31:36 +0000
committershigek <shigek@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-05 09:31:36 +0000
commit70903de1cdd517cc5c4f679e33d0a6ae59d8063a (patch)
treea93ec31dca649e366fbc1ab794af03207dd874b0 /ext
parent808aa5f3183a0ebb20e61c80260fa111b337bec9 (diff)
Trailing 0s in to_s removed. & Bug in VpFrac fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/bigdecimal/bigdecimal.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index edfa65be1b..4f747e2922 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