Mercurial > hg > octave-kai > gnulib-hg
diff tests/test-roundl-ieee.c @ 13988:46007e663235
New module 'roundl-ieee'.
* modules/roundl-ieee: New file.
* m4/roundl.m4 (gl_FUNC_ROUNDL): If gl_FUNC_ROUNDL_IEEE is also used,
test whether roundl works according to ISO C 99 with IEC 60559.
* m4/roundl-ieee.m4: New file.
* modules/roundl-ieee-tests: New file.
* tests/test-roundl-ieee.c: New file, based on tests/test-roundl.c.
* tests/test-roundl.c (main): Remove signbit tests.
* modules/roundl-tests (Depends-on): Remove signbit.
* doc/posix-functions/roundl.texi: Mention the new module.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 21 Dec 2010 22:27:02 +0100 |
parents | |
children | b91bc81df379 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/tests/test-roundl-ieee.c @@ -0,0 +1,38 @@ +/* Test of rounding to nearest, breaking ties away from 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#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 (roundl (0.0L))); + ASSERT (!!signbit (roundl (minus_zerol)) == !!signbit (minus_zerol)); + + return 0; +}