[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-292
From: |
Andrew J. Schorr |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-2925-g77f8c28 |
Date: |
Sun, 11 Feb 2018 15:28:26 -0500 (EST) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-4.2-stable has been updated
via 77f8c28bf85699553947ab12f54ea742c300dd00 (commit)
from c456bfb67cdfd71b869d059ce50335ef80c2c271 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=77f8c28bf85699553947ab12f54ea742c300dd00
commit 77f8c28bf85699553947ab12f54ea742c300dd00
Author: Andrew J. Schorr <address@hidden>
Date: Sun Feb 11 15:28:09 2018 -0500
Add warning to intdiv extension when loss of precision may occur.
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 83d4372..51bd7b7 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2018-02-11 Andrew J. Schorr <address@hidden>
+
+ * intdiv.c (do_intdiv): Print a warning about loss of precision if
+ MPFR arguments are received when not compiled with MPFR support.
+
2018-02-08 Andrew J. Schorr <address@hidden>
* configure.ac (pkgextensiondir): This must be set to
diff --git a/extension/intdiv.c b/extension/intdiv.c
index 529ea36..bd0919c 100644
--- a/extension/intdiv.c
+++ b/extension/intdiv.c
@@ -126,11 +126,21 @@ do_intdiv(int nargs, awk_value_t *result, struct
awk_ext_func *unused)
clear_array(array);
#ifdef HAVE_MPFR
- if (nv.num_type == AWK_NUMBER_TYPE_DOUBLE && dv.num_type ==
AWK_NUMBER_TYPE_DOUBLE) {
+ if (nv.num_type == AWK_NUMBER_TYPE_DOUBLE && dv.num_type ==
AWK_NUMBER_TYPE_DOUBLE)
#endif
+ {
/* regular precision */
double num, denom, quotient, remainder;
+#ifndef HAVE_MPFR
+ if (nv.num_type != AWK_NUMBER_TYPE_DOUBLE || dv.num_type !=
AWK_NUMBER_TYPE_DOUBLE) {
+ static int warned = 0;
+ if (!warned) {
+ warning(ext_id, _("intdiv: MPFR arguments
converted to IEEE because this extension was not compiled with MPFR support;
loss of precision may occur"));
+ warned = 1;
+ }
+ }
+#endif
num = double_to_int(nv.num_value);
denom = double_to_int(dv.num_value);
@@ -150,8 +160,9 @@ do_intdiv(int nargs, awk_value_t *result, struct
awk_ext_func *unused)
array_set_number(array, "quotient", 8, quotient);
array_set_number(array, "remainder", 9, remainder);
+ }
#ifdef HAVE_MPFR
- } else {
+ else {
/* extended precision */
mpz_ptr numer, denom;
mpz_t numer_tmp, denom_tmp;
-----------------------------------------------------------------------
Summary of changes:
extension/ChangeLog | 5 +++++
extension/intdiv.c | 15 +++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-2925-g77f8c28,
Andrew J. Schorr <=