зеркало из https://github.com/github/ruby.git
Bug in negative.exp(n) reported by Hitoshi Miyazaki fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e07677d308
Коммит
57c6f017a0
|
@ -9,6 +9,8 @@
|
|||
* of this BigDecimal distribution.
|
||||
*
|
||||
* NOTES:
|
||||
* 2003-04-17
|
||||
* Bug in negative.exp(n) reported by Hitoshi Miyazaki fixed.
|
||||
* 2003-03-28
|
||||
* V1.0 checked in to CVS(ruby/ext/bigdecimal).
|
||||
* use rb_str2cstr() instead of STR2CSTR().
|
||||
|
@ -4007,6 +4009,7 @@ VpExp(Real *y, Real *x)
|
|||
U_LONG p;
|
||||
U_LONG nc;
|
||||
U_LONG i;
|
||||
short fNeg=0;
|
||||
|
||||
if(!VpIsDef(x)) {
|
||||
VpSetNaN(y); /* Not sure */
|
||||
|
@ -4022,6 +4025,9 @@ VpExp(Real *y, Real *x)
|
|||
if(p<maxnr) nc = maxnr;
|
||||
else nc = p;
|
||||
|
||||
fNeg = x->sign;
|
||||
if(fNeg<0) x->sign = -fNeg;
|
||||
|
||||
/* allocate temporally variables */
|
||||
z = VpAlloc(p, "#1");
|
||||
div = VpAlloc(p, "#1");
|
||||
|
@ -4047,9 +4053,16 @@ VpExp(Real *y, Real *x)
|
|||
VpAsgn(y, div, 1); /* y = y(new) */
|
||||
} while(((!VpIsZero(c)) &&(c->exponent >= 0 ||((U_LONG)(-c->exponent)) <= y->MaxPrec)) &&
|
||||
i<nc
|
||||
);
|
||||
);
|
||||
|
||||
if(fNeg < 0) {
|
||||
x->sign = fNeg;
|
||||
VpDivd(div, r, VpConstOne, y);
|
||||
VpAsgn(y, div, 1);
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
#ifdef _DEBUG
|
||||
if(gfDebug) {
|
||||
VPrint(stdout, "vpexp e=%\n", y);
|
||||
|
|
Загрузка…
Ссылка в новой задаче