gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-458-g975fbde


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-458-g975fbde
Date: Sun, 20 Apr 2014 08:52:31 +0000

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, master has been updated
       via  975fbde5ddb54b76212f25e5f114758ebf91f572 (commit)
       via  698f8a9414180fc1243de799126dcbb57c86592a (commit)
       via  3cdb8b8cf57d6ccfd215d0170c2b616340719d86 (commit)
      from  6afaf0a27a5b9429c74fcbfb505a6d047a0c5d94 (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=975fbde5ddb54b76212f25e5f114758ebf91f572

commit 975fbde5ddb54b76212f25e5f114758ebf91f572
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Apr 20 11:37:26 2014 +0300

    Fix do_rand order-of-evaluation dependency.

diff --git a/ChangeLog b/ChangeLog
index 9254598..f3d950b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-04-20         Arnold D. Robbins     <address@hidden>
+
+       * builtin.c (do_rand): Make calls to random() in predictable
+       order to avoid order of evaluation differences amongst compilers.
+       Thanks to Anders Magnusson <address@hidden> (of the PCC team)
+       for the suggestion.
+
 2014-04-18         Arnold D. Robbins     <address@hidden>
 
        * configure.ac: Change adding of -export-dynamic for GCC to be
diff --git a/builtin.c b/builtin.c
index 875b3e5..3464dc2 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2454,8 +2454,14 @@ do_rand(int nargs ATTRIBUTE_UNUSED)
         */
  
        do {
-               tmprand = 0.5 + ( (random()/RAND_DIVISOR + random())
-                                       / RAND_DIVISOR);
+               long d1, d2;
+               /*
+                * Do the calls in predictable order to avoid
+                * compiler differences in order of evaluation.
+                */
+               d1 = random();
+               d2 = random();
+               tmprand = 0.5 + ( (d1/RAND_DIVISOR + d2) / RAND_DIVISOR );
                tmprand -= 0.5;
        } while (tmprand == 1.0);
 

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=698f8a9414180fc1243de799126dcbb57c86592a

commit 698f8a9414180fc1243de799126dcbb57c86592a
Merge: 6afaf0a 3cdb8b8
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Apr 20 11:26:52 2014 +0300

    Merge branch 'gawk-4.1-stable'


-----------------------------------------------------------------------

Summary of changes:
 ChangeLog  |    7 +++++++
 README.git |    2 +-
 builtin.c  |   10 ++++++++--
 3 files changed, 16 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]