aboutsummaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'command.c')
-rw-r--r--command.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/command.c b/command.c
index 81c601d6..11175561 100644
--- a/command.c
+++ b/command.c
@@ -3260,8 +3260,17 @@ err:
errno = 0;
#ifdef HAVE_MPFR
if (do_mpfr) {
- r = mpg_node();
- (void) mpfr_strtofr(r->mpg_numbr, tokstart, & lexptr, 0, RND_MODE);
+ int tval;
+ r = mpg_float();
+ tval = mpfr_strtofr(r->mpg_numbr, tokstart, & lexptr, 0, RND_MODE);
+ IEEE_FMT(r->mpg_numbr, tval);
+ if (mpfr_integer_p(r->mpg_numbr)) {
+ /* integral value, convert to a GMP type. */
+ NODE *tmp = r;
+ r = mpg_integer();
+ mpfr_get_z(r->mpg_i, tmp->mpg_numbr, MPFR_RNDZ);
+ unref(tmp);
+ }
} else
#endif
r = make_number(strtod(tokstart, & lexptr));