Mercurial > hg > octave-lojdl > gnulib-hg
annotate tests/test-floorl.c @ 16364:89227b989588
fatal-signal: use C prototypes (with explicit void).
* lib/fatal-signal.c (uninstall_handlers, install_handlers)
(init_fatal_signal_set, block_fatal_signals): Fix signatures.
author | Akim Demaille <demaille@gostai.com> |
---|---|
date | Wed, 08 Feb 2012 10:36:20 +0100 |
parents | 8250f2777afc |
children | e542fd46ad6f |
rev | line source |
---|---|
9294 | 1 /* Test of rounding towards negative infinity. |
16201
8250f2777afc
maint: update all copyright year number ranges
Jim Meyering <meyering@redhat.com>
parents:
15595
diff
changeset
|
2 Copyright (C) 2007-2012 Free Software Foundation, Inc. |
9294 | 3 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9294
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify |
9294 | 5 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9294
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9294
diff
changeset
|
7 (at your option) any later version. |
9294 | 8 |
9 This program is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 GNU General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9294
diff
changeset
|
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
9294 | 16 |
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ | |
18 | |
19 #include <config.h> | |
20 | |
21 #include <math.h> | |
22 | |
12489 | 23 #include "signature.h" |
24 SIGNATURE_CHECK (floorl, long double, (long double)); | |
25 | |
10601
ca053fa79cd3
Use a more portable replacement expression for -0.0L.
Bruno Haible <bruno@clisp.org>
parents:
10296
diff
changeset
|
26 #include <float.h> |
9294 | 27 |
28 #include "fpucw.h" | |
29 #include "isnanl-nolibm.h" | |
13834
108bbfd6f03b
frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
30 #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
|
31 #include "infinity.h" |
11224
5aa57cee93aa
avoid gcc 3.4.3 bug on long double NaN on Irix 6.5
Eric Blake <ebb9@byu.net>
parents:
11002
diff
changeset
|
32 #include "nan.h" |
12496
a48d3d749ca5
Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents:
12489
diff
changeset
|
33 #include "macros.h" |
9294 | 34 |
35 int | |
36 main () | |
37 { | |
38 DECL_LONG_DOUBLE_ROUNDING | |
39 | |
40 BEGIN_LONG_DOUBLE_ROUNDING (); | |
41 | |
42 /* Zero. */ | |
43 ASSERT (floorl (0.0L) == 0.0L); | |
13834
108bbfd6f03b
frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
44 ASSERT (floorl (minus_zerol) == 0.0L); |
9294 | 45 /* Positive numbers. */ |
46 ASSERT (floorl (0.3L) == 0.0L); | |
47 ASSERT (floorl (0.7L) == 0.0L); | |
48 ASSERT (floorl (1.0L) == 1.0L); | |
49 ASSERT (floorl (1.5L) == 1.0L); | |
50 ASSERT (floorl (1.999L) == 1.0L); | |
51 ASSERT (floorl (2.0L) == 2.0L); | |
52 ASSERT (floorl (65535.999L) == 65535.0L); | |
53 ASSERT (floorl (65536.0L) == 65536.0L); | |
54 ASSERT (floorl (2.341e31L) == 2.341e31L); | |
55 /* Negative numbers. */ | |
56 ASSERT (floorl (-0.3L) == -1.0L); | |
57 ASSERT (floorl (-0.7L) == -1.0L); | |
58 ASSERT (floorl (-1.0L) == -1.0L); | |
59 ASSERT (floorl (-1.001L) == -2.0L); | |
60 ASSERT (floorl (-1.5L) == -2.0L); | |
61 ASSERT (floorl (-1.999L) == -2.0L); | |
62 ASSERT (floorl (-2.0L) == -2.0L); | |
63 ASSERT (floorl (-65535.999L) == -65536.0L); | |
64 ASSERT (floorl (-65536.0L) == -65536.0L); | |
65 ASSERT (floorl (-2.341e31L) == -2.341e31L); | |
66 /* Infinite numbers. */ | |
15595
328819af1c02
Support for MSVC compiler: Avoid division by a literal 0.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
67 ASSERT (floorl (Infinityl ()) == Infinityl ()); |
328819af1c02
Support for MSVC compiler: Avoid division by a literal 0.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
68 ASSERT (floorl (- Infinityl ()) == - Infinityl ()); |
9294 | 69 /* NaNs. */ |
11224
5aa57cee93aa
avoid gcc 3.4.3 bug on long double NaN on Irix 6.5
Eric Blake <ebb9@byu.net>
parents:
11002
diff
changeset
|
70 ASSERT (isnanl (floorl (NaNl ()))); |
9294 | 71 |
72 return 0; | |
73 } |