summaryrefslogtreecommitdiff
path: root/tests/test-truncf-ieee.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-12-21 15:44:21 +0100
committerBruno Haible <bruno@clisp.org>2010-12-21 17:30:27 +0100
commitfdb0fd9e820d721e6492b041ddc49d49b4c61e64 (patch)
tree5264bfd5faa8bad120b97e544e1efc2f120cd9e9 /tests/test-truncf-ieee.c
parentf10ca7e0a421ace0dd6124bd8f0ba8e7570ebec3 (diff)
downloadgnulib-fdb0fd9e820d721e6492b041ddc49d49b4c61e64.tar.gz
New module 'truncf-ieee'.
* modules/truncf-ieee: New file. * m4/truncf.m4 (gl_FUNC_TRUNCF): If gl_FUNC_TRUNCF_IEEE is also used, test whether truncf works according to ISO C 99 with IEC 60559. * m4/truncf-ieee.m4: New file. * lib/math.in.h (truncf): Replace if REPLACE_TRUNCF is set. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_TRUNCF. * modules/math (Makefile.am): Substitute REPLACE_TRUNCF. * modules/truncf-ieee-tests: New file. * tests/test-truncf-ieee.c: New file, based on tests/test-truncf1.c. * tests/test-truncf1.c (main): Remove signbit tests. * modules/truncf-tests (Depends-on): Remove 'signbit'. * doc/posix-functions/truncf.texi: Mention the new module.
Diffstat (limited to 'tests/test-truncf-ieee.c')
-rw-r--r--tests/test-truncf-ieee.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test-truncf-ieee.c b/tests/test-truncf-ieee.c
new file mode 100644
index 0000000000..c5c779ae70
--- /dev/null
+++ b/tests/test-truncf-ieee.c
@@ -0,0 +1,32 @@
+/* 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 "minus-zero.h"
+#include "macros.h"
+
+int
+main ()
+{
+ /* Zero. */
+ ASSERT (!signbit (truncf (0.0f)));
+ ASSERT (!!signbit (truncf (minus_zerof)) == !!signbit (minus_zerof));
+
+ return 0;
+}