]> Savannah Git Hosting - gnulib.git/commitdiff
qnan: New module.
authorBruno Haible <bruno@clisp.org>
Thu, 12 Oct 2023 19:12:53 +0000 (21:12 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 12 Oct 2023 19:22:58 +0000 (21:22 +0200)
* lib/qnan.h: Renamed from tests/qnan.h. Add double-inclusion guard.
* modules/qnan: New file.
* modules/signbit-tests (Files): Remove tests/qnan.h.
(Depends-on): Add qnan. Remove nan.
* modules/stdio-tests (Files): Remove tests/qnan.h.
(Depends-on): Add qnan. Remove nan.
* modules/totalorder-tests (Files): Remove tests/qnan.h.
(Depends-on): Add qnan. Remove nan, signbit.
* modules/totalorderf-tests (Files): Remove tests/qnan.h.
(Depends-on): Add qnan. Remove nan, signbit.
* modules/totalorderl-tests (Files): Remove tests/qnan.h.
(Depends-on): Add qnan. Remove nan, signbit.

ChangeLog
lib/qnan.h [new file with mode: 0644]
modules/qnan [new file with mode: 0644]
modules/signbit-tests
modules/stdio-tests
modules/totalorder-tests
modules/totalorderf-tests
modules/totalorderl-tests
tests/qnan.h [deleted file]

index 9014954a2f4e569c159927f3eb089e842df04ed0..b072697e2a5be456a960caf27018640fdcb94b3a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2023-10-12  Bruno Haible  <bruno@clisp.org>
+
+       qnan: New module.
+       * lib/qnan.h: Renamed from tests/qnan.h. Add double-inclusion guard.
+       * modules/qnan: New file.
+       * modules/signbit-tests (Files): Remove tests/qnan.h.
+       (Depends-on): Add qnan. Remove nan.
+       * modules/stdio-tests (Files): Remove tests/qnan.h.
+       (Depends-on): Add qnan. Remove nan.
+       * modules/totalorder-tests (Files): Remove tests/qnan.h.
+       (Depends-on): Add qnan. Remove nan, signbit.
+       * modules/totalorderf-tests (Files): Remove tests/qnan.h.
+       (Depends-on): Add qnan. Remove nan, signbit.
+       * modules/totalorderl-tests (Files): Remove tests/qnan.h.
+       (Depends-on): Add qnan. Remove nan, signbit.
+
 2023-10-12  Bruno Haible  <bruno@clisp.org>
 
        nan: New module.
diff --git a/lib/qnan.h b/lib/qnan.h
new file mode 100644 (file)
index 0000000..e6538c2
--- /dev/null
@@ -0,0 +1,88 @@
+/* Macros for quiet not-a-number.
+   Copyright (C) 2023 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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _QNAN_H
+#define _QNAN_H
+
+#include <math.h>
+
+#include "nan.h"
+
+
+/* Returns a quiet 'float' NaN with sign bit == 0.  */
+_GL_UNUSED static float
+positive_NaNf ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  float volatile nan = NaNf ();
+  return (signbit (nan) ? - nan : nan);
+}
+
+/* Returns a quiet 'float' NaN with sign bit == 1.  */
+_GL_UNUSED static float
+negative_NaNf ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  float volatile nan = NaNf ();
+  return (signbit (nan) ? nan : - nan);
+}
+
+
+/* Returns a quiet 'double' NaN with sign bit == 0.  */
+_GL_UNUSED static double
+positive_NaNd ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  double volatile nan = NaNd ();
+  return (signbit (nan) ? - nan : nan);
+}
+
+/* Returns a quiet 'double' NaN with sign bit == 1.  */
+_GL_UNUSED static double
+negative_NaNd ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  double volatile nan = NaNd ();
+  return (signbit (nan) ? nan : - nan);
+}
+
+
+/* Returns a quiet 'long double' NaN with sign bit == 0.  */
+_GL_UNUSED static long double
+positive_NaNl ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  long double volatile nan = NaNl ();
+  return (signbit (nan) ? - nan : nan);
+}
+
+/* Returns a quiet 'long double' NaN with sign bit == 1.  */
+_GL_UNUSED static long double
+negative_NaNl ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  long double volatile nan = NaNl ();
+  return (signbit (nan) ? nan : - nan);
+}
+
+
+#endif /* _QNAN_H */
diff --git a/modules/qnan b/modules/qnan
new file mode 100644 (file)
index 0000000..fd3cbb5
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+Macros for quiet not-a-number.
+
+Files:
+lib/qnan.h
+
+Depends-on:
+nan
+signbit
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += qnan.h
+
+Include:
+"qnan.h"
+
+Link:
+
+License:
+GPL
+
+Maintainer:
+all
index 6e414ea4f267cd72c0fcc2a47d98cb5fbdb7f641..c194881503bd8e599c209292d0c8a394a9ac2100 100644 (file)
@@ -2,7 +2,6 @@ Files:
 tests/test-signbit.c
 tests/minus-zero.h
 tests/infinity.h
-tests/qnan.h
 tests/snan.h
 tests/macros.h
 m4/exponentf.m4
@@ -11,7 +10,7 @@ m4/exponentl.m4
 
 Depends-on:
 float
-nan
+qnan
 
 configure.ac:
 AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION])
index f0dc1d054f540590ed08fe7c5e192cac34e5b401..d1bec9d4412e2cbf276f6e821f7494dbde51df87 100644 (file)
@@ -1,13 +1,12 @@
 Files:
 tests/test-stdio.c
-tests/qnan.h
 tests/snan.h
 tests/macros.h
 m4/exponentd.m4
 
 Depends-on:
 assert-h
-nan
+qnan
 stdio-c++-tests
 fgetc-tests
 fputc-tests
index 6bddc21593b9cc3dd3082500a295d8749b42652f..5ff4c752f0f47471788ccd23f7a28a0da60947fc 100644 (file)
@@ -2,12 +2,10 @@ Files:
 tests/test-totalorder.c
 tests/minus-zero.h
 tests/infinity.h
-tests/qnan.h
 tests/macros.h
 
 Depends-on:
-nan
-signbit
+qnan
 
 configure.ac:
 
index 688536be81a0216885534a6aaa1bb426d7e26ae8..7e2e7938f651c5feee25cd7d44ca2672713e9ccd 100644 (file)
@@ -3,12 +3,10 @@ tests/test-totalorderf.c
 tests/test-totalorder.c
 tests/minus-zero.h
 tests/infinity.h
-tests/qnan.h
 tests/macros.h
 
 Depends-on:
-nan
-signbit
+qnan
 
 configure.ac:
 
index 1502a9d5ce4abd39bada12e4a815f23a930af34f..1b6ca5200fb9d5184ee0599839a536ea06e5deea 100644 (file)
@@ -3,12 +3,10 @@ tests/test-totalorderl.c
 tests/test-totalorder.c
 tests/minus-zero.h
 tests/infinity.h
-tests/qnan.h
 tests/macros.h
 
 Depends-on:
-nan
-signbit
+qnan
 
 configure.ac:
 
diff --git a/tests/qnan.h b/tests/qnan.h
deleted file mode 100644 (file)
index 7006699..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Macros for quiet not-a-number.
-   Copyright (C) 2023 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
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-#include "nan.h"
-
-
-/* Returns a quiet 'float' NaN with sign bit == 0.  */
-_GL_UNUSED static float
-positive_NaNf ()
-{
-  /* 'volatile' works around a GCC bug:
-     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
-  float volatile nan = NaNf ();
-  return (signbit (nan) ? - nan : nan);
-}
-
-/* Returns a quiet 'float' NaN with sign bit == 1.  */
-_GL_UNUSED static float
-negative_NaNf ()
-{
-  /* 'volatile' works around a GCC bug:
-     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
-  float volatile nan = NaNf ();
-  return (signbit (nan) ? nan : - nan);
-}
-
-
-/* Returns a quiet 'double' NaN with sign bit == 0.  */
-_GL_UNUSED static double
-positive_NaNd ()
-{
-  /* 'volatile' works around a GCC bug:
-     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
-  double volatile nan = NaNd ();
-  return (signbit (nan) ? - nan : nan);
-}
-
-/* Returns a quiet 'double' NaN with sign bit == 1.  */
-_GL_UNUSED static double
-negative_NaNd ()
-{
-  /* 'volatile' works around a GCC bug:
-     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
-  double volatile nan = NaNd ();
-  return (signbit (nan) ? nan : - nan);
-}
-
-
-/* Returns a quiet 'long double' NaN with sign bit == 0.  */
-_GL_UNUSED static long double
-positive_NaNl ()
-{
-  /* 'volatile' works around a GCC bug:
-     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
-  long double volatile nan = NaNl ();
-  return (signbit (nan) ? - nan : nan);
-}
-
-/* Returns a quiet 'long double' NaN with sign bit == 1.  */
-_GL_UNUSED static long double
-negative_NaNl ()
-{
-  /* 'volatile' works around a GCC bug:
-     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
-  long double volatile nan = NaNl ();
-  return (signbit (nan) ? nan : - nan);
-}