diff options
Diffstat (limited to 'big.c')
-rw-r--r-- | big.c | 30 |
1 files changed, 10 insertions, 20 deletions
@@ -620,34 +620,24 @@ word bigpow(word x, word y) return r; } -double bigtodbl(x) -word x; +double bigtodbl(word x) { word s = big_is_negative(x); - double b = 1.0, r = (double)digit0(x); + double b = 1.0; + double r = (double)digit0(x); x = rest(x); - while (x) - b = b * IBASE, r = r + b * digit(x), x = rest(x); - if (s) - return (-r); - return (r); + while (x) { + b = b * IBASE; + r = r + b * digit(x); + x = rest(x); + } + + return s ? -r : r; } /* small end first */ /* note: can return oo, -oo but is used without surrounding sto_/set)dbl() only in compare() */ -/* not currently used -long double bigtoldbl(x) -word x; -{ int s=big_is_negative(x); - long double b=1.0L, r=digit0(x); - x = rest(x); - while(x)b=b*IBASE,r=r+b*digit(x),x=rest(x); -/*printf("bigtoldbl returns %Le\n",s?-r:r); /* DEBUG - if(s)return(-r); - return(r); -} /* not compatible with std=c90, lib fns eg sqrtl broken */ - word dbltobig(x) /* entier */ double x; { |