[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4398-g50d92ff4
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4398-g50d92ff4 |
Date: |
Thu, 28 Apr 2022 16:17:13 -0400 (EDT) |
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-5.1-stable has been updated
via 50d92ff4fee27a6d4b644293422c6373ad90812d (commit)
from 4afcd655d827cc095e20abbf05b4aa5d41122600 (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=50d92ff4fee27a6d4b644293422c6373ad90812d
commit 50d92ff4fee27a6d4b644293422c6373ad90812d
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Apr 28 23:16:39 2022 +0300
Fix MPFR unary minus on a zero value.
diff --git a/ChangeLog b/ChangeLog
index c8a45aff..5bae2105 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,13 @@
* interpret.h (r_interpret): Add checks at Op_sub_array case.
+ Unrelated. Fix MPFR mode unary minus applied to a variable with
+ a zero MPG value. Also reported by Jason C. Kwan.
+
+ * mpfr.c (mpg_interpret): Fix Op_unary_minus to create an
+ MPFR -0 value. MPG doesn't distinguish negative zero from
+ positive zero.
+
2022-04-21 Arnold D. Robbins <arnold@skeeve.com>
Fix some profiling issues related to comments in switch / case
diff --git a/mpfr.c b/mpfr.c
index dbaacb5c..14d6becd 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -1795,8 +1795,17 @@ mod:
tval = mpfr_neg(r->mpg_numbr, t1->mpg_numbr,
ROUND_MODE);
IEEE_FMT(r->mpg_numbr, tval);
} else {
- r = mpg_integer();
- mpz_neg(r->mpg_i, t1->mpg_i);
+ if (! is_zero(t1)) {
+ r = mpg_integer();
+ mpz_neg(r->mpg_i, t1->mpg_i);
+ } else {
+ // have to convert to MPFR for -0.0. sigh
+ r = mpg_float();
+ tval = mpfr_set_d(r->mpg_numbr, 0.0,
ROUND_MODE);
+ IEEE_FMT(r->mpg_numbr, tval);
+ tval = mpfr_neg(r->mpg_numbr, r->mpg_numbr,
ROUND_MODE);
+ IEEE_FMT(r->mpg_numbr, tval);
+ }
}
DEREF(t1);
REPLACE(r);
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 13971a0f..666187d7 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -260,7 +260,7 @@ NEED_MPFR = \
mpfrbigint mpfrbigint2 mpfrcase mpfrcase2 mpfrexprange mpfrfield \
mpfrieee mpfrmemok1 mpfrnegzero mpfrnonum mpfrnr mpfrrem mpfrrnd \
mpfrrndeval mpfrsort mpfrsqrt mpfrstrtonum mpgforcenum mpfruplus \
- mpfranswer42
+ mpfranswer42 mpfrnegzero2
# List of tests that need --non-decimal-data
@@ -3685,6 +3685,11 @@ mpgforcenum:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+mpfrnegzero2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
# end of file Maketests
# Targets generated for other tests:
diff --git a/test/ChangeLog b/test/ChangeLog
index 142f8d2d..16d04218 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -3,6 +3,12 @@
* Makefile.am (EXTRA_DIST): symtab12, new test.
* symtab12.awk, symtab12.ok: New files.
+ Unrelated:
+
+ * Makefile.am (EXTRA_DIST): mpfrnegzero2, new test.
+ (NEED_MPFR): Ditto.
+ * mpfrnegzero2.awk, mpfrnegzero2.ok: New files.
+
2022-04-27 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): regex3minus, new test.
@@ -495,7 +501,7 @@
2019-05-07 Arnold D. Robbins <arnold@skeeve.com>
- * Gentests: Finish handlinig NEED_SANDBOX.
+ * Gentests: Finish handling NEED_SANDBOX.
2019-05-06 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/test/Makefile.am b/test/Makefile.am
index 33fd4317..eade5437 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -746,6 +746,8 @@ EXTRA_DIST = \
mpfrmemok1.ok \
mpfrnegzero.awk \
mpfrnegzero.ok \
+ mpfrnegzero2.awk \
+ mpfrnegzero2.ok \
mpfrnonum.awk \
mpfrnonum.in \
mpfrnonum.ok \
@@ -1527,7 +1529,7 @@ NEED_MPFR = \
mpfrbigint mpfrbigint2 mpfrcase mpfrcase2 mpfrexprange mpfrfield \
mpfrieee mpfrmemok1 mpfrnegzero mpfrnonum mpfrnr mpfrrem mpfrrnd \
mpfrrndeval mpfrsort mpfrsqrt mpfrstrtonum mpgforcenum mpfruplus \
- mpfranswer42
+ mpfranswer42 mpfrnegzero2
# List of tests that need --non-decimal-data
NEED_NONDEC = mpfrbigint2 nondec2 intarray forcenum
diff --git a/test/Makefile.in b/test/Makefile.in
index 5d6f9107..cb6c2b2c 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1012,6 +1012,8 @@ EXTRA_DIST = \
mpfrmemok1.ok \
mpfrnegzero.awk \
mpfrnegzero.ok \
+ mpfrnegzero2.awk \
+ mpfrnegzero2.ok \
mpfrnonum.awk \
mpfrnonum.in \
mpfrnonum.ok \
@@ -1791,7 +1793,7 @@ NEED_MPFR = \
mpfrbigint mpfrbigint2 mpfrcase mpfrcase2 mpfrexprange mpfrfield \
mpfrieee mpfrmemok1 mpfrnegzero mpfrnonum mpfrnr mpfrrem mpfrrnd \
mpfrrndeval mpfrsort mpfrsqrt mpfrstrtonum mpgforcenum mpfruplus \
- mpfranswer42
+ mpfranswer42 mpfrnegzero2
# List of tests that need --non-decimal-data
@@ -5364,6 +5366,11 @@ mpgforcenum:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+mpfrnegzero2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
# end of file Maketests
# Targets generated for other tests:
diff --git a/test/Maketests b/test/Maketests
index 9ab86f00..8d19ea87 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -2401,4 +2401,9 @@ mpgforcenum:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+mpfrnegzero2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
# end of file Maketests
diff --git a/test/mpfrnegzero2.awk b/test/mpfrnegzero2.awk
new file mode 100644
index 00000000..b1e6b8ee
--- /dev/null
+++ b/test/mpfrnegzero2.awk
@@ -0,0 +1,3 @@
+BEGIN {
+ printf("%f\n", -a)
+}
diff --git a/test/mpfrnegzero2.ok b/test/mpfrnegzero2.ok
new file mode 100644
index 00000000..c8713d7c
--- /dev/null
+++ b/test/mpfrnegzero2.ok
@@ -0,0 +1 @@
+-0.000000
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 7 +++++++
mpfr.c | 13 +++++++++++--
pc/Makefile.tst | 7 ++++++-
test/ChangeLog | 8 +++++++-
test/Makefile.am | 4 +++-
test/Makefile.in | 9 ++++++++-
test/Maketests | 5 +++++
test/mpfrnegzero2.awk | 3 +++
test/mpfrnegzero2.ok | 1 +
9 files changed, 51 insertions(+), 6 deletions(-)
create mode 100644 test/mpfrnegzero2.awk
create mode 100644 test/mpfrnegzero2.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4398-g50d92ff4,
Arnold Robbins <=