aboutsummaryrefslogtreecommitdiffstats
path: root/command.y
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-03-01 20:29:12 +0200
committerArnold D. Robbins <arnold@skeeve.com>2012-03-01 20:29:12 +0200
commit473623f186c3699c8886ccdd8a2afb7f4fe7a07e (patch)
tree40b075a492be67b317635d9102e2441d74ce9569 /command.y
parent2b8a8424212839cd30490e4245c0c5119904eca3 (diff)
parent1c06c5c6f0f6d46f63977dd7407d86ccc2614226 (diff)
downloadegawk-473623f186c3699c8886ccdd8a2afb7f4fe7a07e.tar.gz
egawk-473623f186c3699c8886ccdd8a2afb7f4fe7a07e.tar.bz2
egawk-473623f186c3699c8886ccdd8a2afb7f4fe7a07e.zip
Merge branch 'gawk_mpfr' of git.sv.gnu.org:/srv/git/gawk into gawk_mpfr
Diffstat (limited to 'command.y')
-rw-r--r--command.y18
1 files changed, 12 insertions, 6 deletions
diff --git a/command.y b/command.y
index 64066a02..e36497ad 100644
--- a/command.y
+++ b/command.y
@@ -685,7 +685,7 @@ node
if ((n->flags & NUMBER) == 0)
yyerror(_("non-numeric value found, numeric expected"));
else
- $2->a_node->numbr = - n->numbr;
+ negate_num(n);
$$ = $2;
}
;
@@ -1238,22 +1238,28 @@ err:
return D_STRING;
}
- /* assert(want_nodval == TRUE); */
-
/* look for awk number */
if (isdigit((unsigned char) tokstart[0])) {
- double d;
+ NODE *r = NULL;
errno = 0;
- d = strtod(tokstart, &lexptr);
+#ifdef HAVE_MPFR
+ if (do_mpfr) {
+ r = mpg_node();
+ (void) mpfr_strtofr(r->mpg_numbr, tokstart, & lexptr, 0, RND_MODE);
+ } else
+#endif
+ r = make_number(strtod(tokstart, & lexptr));
+
if (errno != 0) {
yyerror(strerror(errno));
+ unref(r);
errno = 0;
return '\n';
}
yylval = mk_cmdarg(D_node);
- yylval->a_node = make_number(d);
+ yylval->a_node = r;
append_cmdarg(yylval);
return D_NODE;
}