aboutsummaryrefslogtreecommitdiffstats
path: root/ext/bigdecimal
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r--ext/bigdecimal/bigdecimal.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 754c319991..3051143b07 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -3944,7 +3944,12 @@ VpCtoV(Real *a, const char *int_chr, U_LONG ni, const char *frac, U_LONG nf, con
es = e*((S_INT)BASE_FIG);
e = e * 10 + exp_chr[i] - '0';
if(es>e*((S_INT)BASE_FIG)) {
- return VpException(VP_EXCEPTION_INFINITY,"exponent overflow",0);
+ VpException(VP_EXCEPTION_INFINITY,"exponent overflow",0);
+ sign = 1;
+ if(int_chr[0] == '-') sign = -1;
+ if(signe > 0) VpSetInf(a, sign);
+ else VpSetZero(a, sign);
+ return 1;
}
++i;
}
@@ -4633,8 +4638,20 @@ VpPower(Real *y, Real *x, S_INT n)
}
goto Exit;
}
- if(!VpIsDef(x)) {
- VpSetNaN(y); /* Not sure !!! */
+ if(VpIsNaN(x)) {
+ VpSetNaN(y);
+ goto Exit;
+ }
+ if(VpIsInf(x)) {
+ if(n==0) {
+ VpSetOne(y);
+ goto Exit;
+ }
+ if(n>0) {
+ VpSetInf(y, (n%2==0 || VpIsPosInf(x)) ? 1 : -1);
+ goto Exit;
+ }
+ VpSetZero(y, (n%2==0 || VpIsPosInf(x)) ? 1 : -1);
goto Exit;
}