summaryrefslogtreecommitdiff
path: root/mpfr.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2017-01-06 14:48:53 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2017-01-06 14:48:53 -0500
commit9ef43720d1b2b3125f4367f3ccf2cb7129d1a9ba (patch)
tree7b5339408b9770e2db7483eda61af2166635e912 /mpfr.c
parent0cb66f4f80cc8c2df63aed30e2cf5753a106b951 (diff)
downloadgawk-9ef43720d1b2b3125f4367f3ccf2cb7129d1a9ba.tar.gz
Enhance API to support extended-precision arithmetic and implement intdiv as a demonstration.
Diffstat (limited to 'mpfr.c')
-rw-r--r--mpfr.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/mpfr.c b/mpfr.c
index c0f1ff0c..4b875668 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -105,26 +105,14 @@ cleanup_mpfr(void)
NODE *
mpg_node(unsigned int tp)
{
- NODE *r;
- getnode(r);
- r->type = Node_val;
+ NODE *r = make_number_node(tp);
- if (tp == MPFN) {
+ if (tp == MPFN)
/* Initialize, set precision to the default precision, and value to NaN */
mpfr_init(r->mpg_numbr);
- r->flags = MPFN;
- } else {
+ else
/* Initialize and set value to 0 */
mpz_init(r->mpg_i);
- r->flags = MPZN;
- }
-
- r->valref = 1;
- r->flags |= MALLOC|NUMBER|NUMCUR;
- r->stptr = NULL;
- r->stlen = 0;
- r->wstptr = NULL;
- r->wstlen = 0;
return r;
}