[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fenv-exceptions-trapping tests: Comments
From: |
Bruno Haible |
Subject: |
fenv-exceptions-trapping tests: Comments |
Date: |
Tue, 07 Nov 2023 21:42:25 +0100 |
A small riddle: What does this loop do?
int exceptions = 0;
do
{
...
exceptions = (exceptions - FE_ALL_EXCEPT) & FE_ALL_EXCEPT;
}
while (exceptions != 0);
2023-11-07 Bruno Haible <bruno@clisp.org>
fenv-exceptions-trapping tests: Comments.
* tests/test-fenv-except-trapping-1.c (main): Add a comment.
diff --git a/tests/test-fenv-except-trapping-1.c
b/tests/test-fenv-except-trapping-1.c
index 7c67a06ec9..e717bb1739 100644
--- a/tests/test-fenv-except-trapping-1.c
+++ b/tests/test-fenv-except-trapping-1.c
@@ -44,7 +44,11 @@ main ()
unsigned int a, b;
/* Run through all possible valid arguments to feenableexcept and
- fedisableexcept. */
+ fedisableexcept.
+ An alternative way of coding this iteration, without the
uint_to_exceptions
+ function, would be using the trick from
+ Jörg Arndt: Matters Computational <https://www.jjj.de/fxt/fxtbook.pdf>
+ § 1.25.1 Generating bit subsets of a given word */
for (a = 0; a < 0x20; a++)
for (b = 0; b < 0x20; b++)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- fenv-exceptions-trapping tests: Comments,
Bruno Haible <=