Mercurial > gnulib
annotate tests/test-truncf1.c @ 17363:5a51fb7777a9
sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Problem reported by Marco Atzeri in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>.
* lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]:
Simply delegate to the system <sys/select.h> in this case too.
Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only
if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to
be needed on Solaris either.
* lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]:
Simply delgate to the system <sys/time.h> in this case.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 19 Mar 2013 09:08:47 -0700 |
parents | e542fd46ad6f |
children | 344018b6e5d7 |
rev | line source |
---|---|
9325
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* Test of rounding towards zero. |
17249
e542fd46ad6f
maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents:
16201
diff
changeset
|
2 Copyright (C) 2007-2013 Free Software Foundation, Inc. |
9325
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 (at your option) any later version. |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 GNU General Public License for more details. |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 #include <config.h> |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 #include <math.h> |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 |
12489 | 23 #include "signature.h" |
24 SIGNATURE_CHECK (truncf, float, (float)); | |
25 | |
10264
ebb7ea0c94e8
Rename isnand.h to isnand-nolibm.h, similarly for isnanf.h.
Ben Pfaff <blp@cs.stanford.edu>
parents:
9889
diff
changeset
|
26 #include "isnanf-nolibm.h" |
13834
108bbfd6f03b
frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
27 #include "minus-zero.h" |
15595
328819af1c02
Support for MSVC compiler: Avoid division by a literal 0.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
28 #include "infinity.h" |
9854
baba3b346ab2
Use macros NaNf, NaNd, NaNl instead of NAN.
Bruno Haible <bruno@clisp.org>
parents:
9850
diff
changeset
|
29 #include "nan.h" |
12496
a48d3d749ca5
Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents:
12489
diff
changeset
|
30 #include "macros.h" |
9325
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 int |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 main () |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 { |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 /* Zero. */ |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 ASSERT (truncf (0.0f) == 0.0f); |
13834
108bbfd6f03b
frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
37 ASSERT (truncf (minus_zerof) == 0.0f); |
9325
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 /* Positive numbers. */ |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 ASSERT (truncf (0.3f) == 0.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 ASSERT (truncf (0.7f) == 0.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 ASSERT (truncf (1.0f) == 1.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 ASSERT (truncf (1.5f) == 1.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 ASSERT (truncf (1.999f) == 1.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 ASSERT (truncf (2.0f) == 2.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 ASSERT (truncf (65535.99f) == 65535.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
46 ASSERT (truncf (65536.0f) == 65536.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 ASSERT (truncf (2.341e31f) == 2.341e31f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 /* Negative numbers. */ |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 ASSERT (truncf (-0.3f) == 0.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 ASSERT (truncf (-0.7f) == 0.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 ASSERT (truncf (-1.0f) == -1.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 ASSERT (truncf (-1.5f) == -1.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 ASSERT (truncf (-1.999f) == -1.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 ASSERT (truncf (-2.0f) == -2.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 ASSERT (truncf (-65535.99f) == -65535.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 ASSERT (truncf (-65536.0f) == -65536.0f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 ASSERT (truncf (-2.341e31f) == -2.341e31f); |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 /* Infinite numbers. */ |
15595
328819af1c02
Support for MSVC compiler: Avoid division by a literal 0.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
59 ASSERT (truncf (Infinityf ()) == Infinityf ()); |
328819af1c02
Support for MSVC compiler: Avoid division by a literal 0.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
60 ASSERT (truncf (- Infinityf ()) == - Infinityf ()); |
9325
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 /* NaNs. */ |
9854
baba3b346ab2
Use macros NaNf, NaNd, NaNl instead of NAN.
Bruno Haible <bruno@clisp.org>
parents:
9850
diff
changeset
|
62 ASSERT (isnanf (truncf (NaNf ()))); |
9325
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
63 |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 return 0; |
752dd5bd3fc6
Rename test-truncf.c to test-truncf1.c.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 } |