annotate tests/test-frexp.c @ 40057:b06060465f09

maint: Run 'make update-copyright'
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 01 Jan 2019 00:25:11 +0100
parents 10eb9086bea0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8492
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of splitting a double into fraction and mantissa.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 Copyright (C) 2007-2019 Free Software Foundation, Inc.
8492
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8754
diff changeset
4 This program is free software: you can redistribute it and/or modify
8492
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
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: 8754
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: 8754
diff changeset
7 (at your option) any later version.
8492
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
8492
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <math.h>
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
12489
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12421
diff changeset
23 #include "signature.h"
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12421
diff changeset
24 SIGNATURE_CHECK (frexp, double, (double, int *));
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12421
diff changeset
25
8492
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #include <float.h>
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
10264
ebb7ea0c94e8 Rename isnand.h to isnand-nolibm.h, similarly for isnanf.h.
Ben Pfaff <blp@cs.stanford.edu>
parents: 9916
diff changeset
28 #include "isnand-nolibm.h"
13834
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 12559
diff changeset
29 #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
30 #include "infinity.h"
9854
baba3b346ab2 Use macros NaNf, NaNd, NaNl instead of NAN.
Bruno Haible <bruno@clisp.org>
parents: 9850
diff changeset
31 #include "nan.h"
12496
a48d3d749ca5 Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents: 12489
diff changeset
32 #include "macros.h"
8545
418f381347dc Work around IRIX 6.5 cc compiler bug, which simplifies x != x to false.
Bruno Haible <bruno@clisp.org>
parents: 8543
diff changeset
33
9860
6c7dda791c34 Avoid some warnings from "gcc -Wshadow".
Jim Meyering <meyering@redhat.com>
parents: 9854
diff changeset
34 /* Avoid some warnings from "gcc -Wshadow".
6c7dda791c34 Avoid some warnings from "gcc -Wshadow".
Jim Meyering <meyering@redhat.com>
parents: 9854
diff changeset
35 This file doesn't use the exp() function. */
9916
3826b3abb5d0 Fix compilation failure on AIX with xlc.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
36 #undef exp
9860
6c7dda791c34 Avoid some warnings from "gcc -Wshadow".
Jim Meyering <meyering@redhat.com>
parents: 9854
diff changeset
37 #define exp exponent
6c7dda791c34 Avoid some warnings from "gcc -Wshadow".
Jim Meyering <meyering@redhat.com>
parents: 9854
diff changeset
38
16557
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
39 #undef INFINITY
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
40 #undef NAN
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
41
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
42 #define DOUBLE double
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
43 /* The use of 'volatile' guarantees that excess precision bits are dropped
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
44 when dealing with denormalized numbers. It is necessary on x86 systems
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
45 where double-floats are not IEEE compliant by default, to avoid that the
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
46 results become platform and compiler option dependent. 'volatile' is a
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
47 portable alternative to gcc's -ffloat-store option. */
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
48 #define VOLATILE volatile
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
49 #define ISNAN isnand
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
50 #define INFINITY Infinityd ()
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
51 #define NAN NaNd ()
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
52 #define L_(literal) literal
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
53 #define MINUS_ZERO minus_zerod
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
54 #define MAX_EXP DBL_MAX_EXP
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
55 #define MIN_EXP DBL_MIN_EXP
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
56 #define MIN_NORMAL_EXP DBL_MIN_EXP
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
57 #define FREXP frexp
16559
b576f9917ed1 frexp* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16557
diff changeset
58 #define RANDOM randomd
16557
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
59 #include "test-frexp.h"
8492
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 int
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 main ()
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 {
16557
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
64 test_function ();
8492
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 return 0;
1dcdd2ec146b Tests for module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 }