aboutsummaryrefslogtreecommitdiffstats
path: root/command.y
diff options
context:
space:
mode:
authorjohn haque <j.eh@mchsi.com>2012-02-26 06:57:48 -0600
committerjohn haque <j.eh@mchsi.com>2012-02-26 06:57:48 -0600
commit1c06c5c6f0f6d46f63977dd7407d86ccc2614226 (patch)
tree5763e51d36264e6f84a70e480d063b788c2f47cf /command.y
parentcb17a712ea65f6510e0000374cce4efbf4ffb902 (diff)
downloadegawk-1c06c5c6f0f6d46f63977dd7407d86ccc2614226.tar.gz
egawk-1c06c5c6f0f6d46f63977dd7407d86ccc2614226.tar.bz2
egawk-1c06c5c6f0f6d46f63977dd7407d86ccc2614226.zip
Finish MPFR changes and clean up code.
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;
}