aboutsummaryrefslogtreecommitdiffstats
path: root/mpfr.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-01-10 22:14:27 +0200
committerArnold D. Robbins <arnold@skeeve.com>2018-01-10 22:14:27 +0200
commitcc8c981c9eaed42e1afd278afac787cd2aeab55f (patch)
tree66daeb2dc1049a6112445705f6b92cea55958bd7 /mpfr.c
parentdd2516767fa58d56684e003f646ef6d611051a64 (diff)
parent7d463f19f1fc98a7d4f99e3575c545ca7009d9db (diff)
downloadegawk-cc8c981c9eaed42e1afd278afac787cd2aeab55f.tar.gz
egawk-cc8c981c9eaed42e1afd278afac787cd2aeab55f.tar.bz2
egawk-cc8c981c9eaed42e1afd278afac787cd2aeab55f.zip
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'mpfr.c')
-rw-r--r--mpfr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mpfr.c b/mpfr.c
index b9208a6b..1c4a2b9b 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -3,7 +3,8 @@
*/
/*
- * Copyright (C) 2012, 2013, 2015, 2017, the Free Software Foundation, Inc.
+ * Copyright (C) 2012, 2013, 2015, 2017, 2018,
+ * the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -27,6 +28,8 @@
#ifdef HAVE_MPFR
+int MPFR_round_mode = 'N'; // default value
+
#if !defined(MPFR_VERSION_MAJOR) || MPFR_VERSION_MAJOR < 3
typedef mp_exp_t mpfr_exp_t;
#endif
@@ -373,6 +376,7 @@ mpg_format_val(const char *format, int index, NODE *s)
efree(s->stptr);
s->stptr = r->stptr;
s->flags |= STRCUR;
+ s->strndmode = MPFR_round_mode;
freenode(r); /* Do not unref(r)! We want to keep s->stptr == r->stpr. */
free_wstr(s);
return s;
@@ -596,6 +600,7 @@ set_ROUNDMODE()
if (rndm != -1) {
mpfr_set_default_rounding_mode(rndm);
ROUND_MODE = rndm;
+ MPFR_round_mode = n->stptr[0];
} else
warning(_("RNDMODE value `%.*s' is invalid"), (int) n->stlen, n->stptr);
}