mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/bigdecimal/bigdecimal.c (BigDecimal_divide): fix precision too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
03ad923cdd
commit
520053232e
2 changed files with 7 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Tue Feb 9 23:48:25 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* ext/bigdecimal/bigdecimal.c (BigDecimal_divide): fix precision too.
|
||||||
|
|
||||||
Tue Feb 9 23:26:07 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
Tue Feb 9 23:26:07 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): fix precision.
|
* ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): fix precision.
|
||||||
|
|
|
@ -882,7 +882,9 @@ BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r)
|
||||||
if(!b) return DoSomeOne(self,r,'/');
|
if(!b) return DoSomeOne(self,r,'/');
|
||||||
SAVE(b);
|
SAVE(b);
|
||||||
*div = b;
|
*div = b;
|
||||||
mx =(a->MaxPrec + b->MaxPrec + 1) * VpBaseFig();
|
mx = a->Prec+abs(a->exponent);
|
||||||
|
if(mx<b->Prec+abs(b->exponent)) mx = b->Prec+abs(b->exponent);
|
||||||
|
mx =(mx + 1) * VpBaseFig();
|
||||||
GUARD_OBJ((*c),VpCreateRbObject(mx, "#0"));
|
GUARD_OBJ((*c),VpCreateRbObject(mx, "#0"));
|
||||||
GUARD_OBJ((*res),VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
|
GUARD_OBJ((*res),VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
|
||||||
VpDivd(*c, *res, a, b);
|
VpDivd(*c, *res, a, b);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue