summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-12-21 22:04:25 +0100
committerBruno Haible <bruno@clisp.org>2010-12-21 22:50:16 +0100
commit8fe3f433681b195f1deef11bcb4ccec850597c81 (patch)
tree56ccb29e0f0248ec6b9e997f3244147ac100ff1d
parent581b1c58f176167b473c8e79ed7b3f1786adfd02 (diff)
downloadgnulib-8fe3f433681b195f1deef11bcb4ccec850597c81.tar.gz
New module 'truncl-ieee'.
* modules/truncl-ieee: New file. * modules/truncl-ieee-tests: New file. * tests/test-truncl-ieee.c: New file, based on tests/test-truncl.c. * tests/test-truncl.c (main): Remove signbit tests. * modules/truncl-tests (Depends-on): Remove signbit. * doc/posix-functions/truncl.texi: Mention the new module.
-rw-r--r--ChangeLog10
-rw-r--r--doc/posix-functions/truncl.texi2
-rw-r--r--modules/truncl-ieee23
-rw-r--r--modules/truncl-ieee-tests16
-rw-r--r--modules/truncl-tests1
-rw-r--r--tests/test-truncl-ieee.c37
-rw-r--r--tests/test-truncl.c2
7 files changed, 87 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e0c502008..0208548bbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2010-12-21 Bruno Haible <bruno@clisp.org>
+ New module 'truncl-ieee'.
+ * modules/truncl-ieee: New file.
+ * modules/truncl-ieee-tests: New file.
+ * tests/test-truncl-ieee.c: New file, based on tests/test-truncl.c.
+ * tests/test-truncl.c (main): Remove signbit tests.
+ * modules/truncl-tests (Depends-on): Remove signbit.
+ * doc/posix-functions/truncl.texi: Mention the new module.
+
+2010-12-21 Bruno Haible <bruno@clisp.org>
+
New module 'ceill-ieee'.
* modules/ceill-ieee: New file.
* modules/ceill-ieee-tests: New file.
diff --git a/doc/posix-functions/truncl.texi b/doc/posix-functions/truncl.texi
index 8afac2f358..442704ec06 100644
--- a/doc/posix-functions/truncl.texi
+++ b/doc/posix-functions/truncl.texi
@@ -4,7 +4,7 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/truncl.html}
-Gnulib module: truncl
+Gnulib module: truncl or truncl-ieee
Portability problems fixed by Gnulib:
@itemize
diff --git a/modules/truncl-ieee b/modules/truncl-ieee
new file mode 100644
index 0000000000..b3acf18bb9
--- /dev/null
+++ b/modules/truncl-ieee
@@ -0,0 +1,23 @@
+Description:
+truncl() function according to ISO C 99 with IEC 60559.
+
+Files:
+
+Depends-on:
+truncl
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(TRUNCL_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/truncl-ieee-tests b/modules/truncl-ieee-tests
new file mode 100644
index 0000000000..a2fed3fdf5
--- /dev/null
+++ b/modules/truncl-ieee-tests
@@ -0,0 +1,16 @@
+Files:
+tests/test-truncl-ieee.c
+tests/minus-zero.h
+tests/macros.h
+
+Depends-on:
+fpucw
+float
+signbit
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-truncl-ieee
+check_PROGRAMS += test-truncl-ieee
+test_truncl_ieee_LDADD = $(LDADD) @TRUNCL_LIBM@
diff --git a/modules/truncl-tests b/modules/truncl-tests
index 47276e2c1f..01bcf73921 100644
--- a/modules/truncl-tests
+++ b/modules/truncl-tests
@@ -9,7 +9,6 @@ Depends-on:
fpucw
isnanl-nolibm
float
-signbit
configure.ac:
diff --git a/tests/test-truncl-ieee.c b/tests/test-truncl-ieee.c
new file mode 100644
index 0000000000..de6c9adf0b
--- /dev/null
+++ b/tests/test-truncl-ieee.c
@@ -0,0 +1,37 @@
+/* Test of rounding towards zero.
+ Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "fpucw.h"
+#include "minus-zero.h"
+#include "macros.h"
+
+int
+main ()
+{
+ DECL_LONG_DOUBLE_ROUNDING
+
+ BEGIN_LONG_DOUBLE_ROUNDING ();
+
+ /* Zero. */
+ ASSERT (!signbit (truncl (0.0L)));
+ ASSERT (!!signbit (truncl (minus_zerol)) == !!signbit (minus_zerol));
+
+ return 0;
+}
diff --git a/tests/test-truncl.c b/tests/test-truncl.c
index f2a9644eac..ab1f4443f3 100644
--- a/tests/test-truncl.c
+++ b/tests/test-truncl.c
@@ -40,9 +40,7 @@ main ()
/* Zero. */
ASSERT (truncl (0.0L) == 0.0L);
- ASSERT (!signbit (truncl (0.0L)));
ASSERT (truncl (minus_zerol) == 0.0L);
- ASSERT (!!signbit (minus_zerol) == !!signbit (truncl (minus_zerol)));
/* Positive numbers. */
ASSERT (truncl (0.3L) == 0.0L);
ASSERT (truncl (0.7L) == 0.0L);