1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Bug fix: div method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shigek 2003-08-14 15:11:44 +00:00
parent 2f2cb647c1
commit 588c9c66bf

View file

@ -805,11 +805,13 @@ BigDecimal_div2(int argc, VALUE *argv, VALUE self)
U_LONG ix = (U_LONG)GetPositiveInt(n);
U_LONG mx = (ix+VpBaseFig()*2);
U_LONG pl = VpSetPrecLimit(0);
GUARD_OBJ(cv,VpCreateRbObject(mx,"0"));
GUARD_OBJ(av,GetVpValue(self,1));
GUARD_OBJ(bv,GetVpValue(b,1));
mx = cv->MaxPrec+1;
GUARD_OBJ(res,VpCreateRbObject((mx * 2 + 2)*VpBaseFig(), "#0"));
mx = av->Prec + bv->Prec + 2;
if(mx <= cv->MaxPrec) mx = cv->MaxPrec+1;
GUARD_OBJ(res,VpCreateRbObject((mx * 2 + 2)*VpBaseFig(), "#0"));
VpDivd(cv,res,av,bv);
VpSetPrecLimit(pl);
VpLeftRound(cv,VpGetRoundMode(),ix);
@ -1418,7 +1420,7 @@ Init_bigdecimal(void)
*
*/
#ifdef _DEBUG
static int gfDebug = 0; /* Debug switch */
static int gfDebug = 1; /* Debug switch */
static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */
#endif /* _DEBUG */