summaryrefslogtreecommitdiff
path: root/big.c
diff options
context:
space:
mode:
Diffstat (limited to 'big.c')
-rw-r--r--big.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/big.c b/big.c
index 8fba599..1c7aac3 100644
--- a/big.c
+++ b/big.c
@@ -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;
{