summaryrefslogtreecommitdiff
path: root/tests/test-isnanf.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
commit163a663518f33bab48b28431972e580b366b4d49 (patch)
treef518ffabaca4a0b93f0103d617e803792d3b0b43 /tests/test-isnanf.h
parent1b3a8d5ad2ea2f099d514d9dd51ebf926a628076 (diff)
parentdd0000f7e25abe6c28d4329d324fd7fcab54094f (diff)
Merge branch 'release/debian/1.2-1'HEADdebian/1.2-1master
Diffstat (limited to 'tests/test-isnanf.h')
-rw-r--r--tests/test-isnanf.h24
1 files changed, 4 insertions, 20 deletions
diff --git a/tests/test-isnanf.h b/tests/test-isnanf.h
index 0855a031..6f138016 100644
--- a/tests/test-isnanf.h
+++ b/tests/test-isnanf.h
@@ -1,5 +1,5 @@
/* Test of isnanf() substitute.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
#include "minus-zero.h"
#include "infinity.h"
#include "nan.h"
+#include "snan.h"
#include "macros.h"
int
@@ -40,26 +41,9 @@ main ()
ASSERT (!isnanf (- Infinityf ()));
/* Quiet NaN. */
ASSERT (isnanf (NaNf ()));
-#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
+#if HAVE_SNANF
/* Signalling NaN. */
- {
- #define NWORDS \
- ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
- typedef union { float value; unsigned int word[NWORDS]; } memory_float;
- memory_float m;
- m.value = NaNf ();
-# if FLT_EXPBIT0_BIT > 0
- m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1);
-# else
- m.word[FLT_EXPBIT0_WORD + (FLT_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
-# endif
- if (FLT_EXPBIT0_WORD < NWORDS / 2)
- m.word[FLT_EXPBIT0_WORD + 1] |= (unsigned int) 1 << FLT_EXPBIT0_BIT;
- else
- m.word[0] |= (unsigned int) 1;
- ASSERT (isnanf (m.value));
- }
+ ASSERT (isnanf (SNaNf ()));
#endif
return 0;
}