annotate tests/test-frexpl.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8498
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of splitting a 'long double' into fraction and mantissa.
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16559
diff changeset
2 Copyright (C) 2007-2013 Free Software Foundation, Inc.
8498
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8912
diff changeset
4 This program is free software: you can redistribute it and/or modify
8498
accc767de343 Tests for module 'frexpl'.
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: 8912
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: 8912
diff changeset
7 (at your option) any later version.
8498
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
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: 8912
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
8498
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <math.h>
accc767de343 Tests for module 'frexpl'.
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 (frexpl, long double, (long double, int *));
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12421
diff changeset
25
8498
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #include <float.h>
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
8531
52719799a90e New module 'fpucw'.
Bruno Haible <bruno@clisp.org>
parents: 8498
diff changeset
28 #include "fpucw.h"
8545
418f381347dc Work around IRIX 6.5 cc compiler bug, which simplifies x != x to false.
Bruno Haible <bruno@clisp.org>
parents: 8531
diff changeset
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"
8531
52719799a90e New module 'fpucw'.
Bruno Haible <bruno@clisp.org>
parents: 8498
diff changeset
34
9860
6c7dda791c34 Avoid some warnings from "gcc -Wshadow".
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
35 /* Avoid some warnings from "gcc -Wshadow".
6c7dda791c34 Avoid some warnings from "gcc -Wshadow".
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
36 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
37 #undef exp
9860
6c7dda791c34 Avoid some warnings from "gcc -Wshadow".
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
38 #define exp exponent
6c7dda791c34 Avoid some warnings from "gcc -Wshadow".
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
39
16557
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
40 #undef INFINITY
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
41 #undef NAN
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
42
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
43 #define DOUBLE long double
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
44 #define VOLATILE
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
45 #define ISNAN isnanl
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
46 #define INFINITY Infinityl ()
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
47 #define NAN NaNl ()
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
48 #define L_(literal) literal##L
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
49 #define MINUS_ZERO minus_zerol
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
50 #define MAX_EXP LDBL_MAX_EXP
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
51 #define MIN_EXP LDBL_MIN_EXP
8548
7794b324d462 Avoid test failures on IRIX MIPS.
Bruno Haible <bruno@clisp.org>
parents: 8545
diff changeset
52 /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable
8912
74eb90011cf9 Avoid test failures on some PowerPC hardwares.
Bruno Haible <bruno@clisp.org>
parents: 8754
diff changeset
53 exponent for 'long double' is -964. Similarly, on PowerPC machines,
74eb90011cf9 Avoid test failures on some PowerPC hardwares.
Bruno Haible <bruno@clisp.org>
parents: 8754
diff changeset
54 LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double'
74eb90011cf9 Avoid test failures on some PowerPC hardwares.
Bruno Haible <bruno@clisp.org>
parents: 8754
diff changeset
55 is -968. For exponents below that, the precision may be truncated to the
74eb90011cf9 Avoid test failures on some PowerPC hardwares.
Bruno Haible <bruno@clisp.org>
parents: 8754
diff changeset
56 precision used for 'double'. */
8548
7794b324d462 Avoid test failures on IRIX MIPS.
Bruno Haible <bruno@clisp.org>
parents: 8545
diff changeset
57 #ifdef __sgi
7794b324d462 Avoid test failures on IRIX MIPS.
Bruno Haible <bruno@clisp.org>
parents: 8545
diff changeset
58 # define MIN_NORMAL_EXP (LDBL_MIN_EXP + 57)
8912
74eb90011cf9 Avoid test failures on some PowerPC hardwares.
Bruno Haible <bruno@clisp.org>
parents: 8754
diff changeset
59 #elif defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__
74eb90011cf9 Avoid test failures on some PowerPC hardwares.
Bruno Haible <bruno@clisp.org>
parents: 8754
diff changeset
60 # define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53)
8548
7794b324d462 Avoid test failures on IRIX MIPS.
Bruno Haible <bruno@clisp.org>
parents: 8545
diff changeset
61 #else
7794b324d462 Avoid test failures on IRIX MIPS.
Bruno Haible <bruno@clisp.org>
parents: 8545
diff changeset
62 # define MIN_NORMAL_EXP LDBL_MIN_EXP
7794b324d462 Avoid test failures on IRIX MIPS.
Bruno Haible <bruno@clisp.org>
parents: 8545
diff changeset
63 #endif
16557
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
64 #define FREXP frexpl
16559
b576f9917ed1 frexp* tests: More tests.
Bruno Haible <bruno@clisp.org>
parents: 16557
diff changeset
65 #define RANDOM randoml
16557
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
66 #include "test-frexp.h"
8498
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 int
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 main ()
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 {
8531
52719799a90e New module 'fpucw'.
Bruno Haible <bruno@clisp.org>
parents: 8498
diff changeset
71 DECL_LONG_DOUBLE_ROUNDING
52719799a90e New module 'fpucw'.
Bruno Haible <bruno@clisp.org>
parents: 8498
diff changeset
72
52719799a90e New module 'fpucw'.
Bruno Haible <bruno@clisp.org>
parents: 8498
diff changeset
73 BEGIN_LONG_DOUBLE_ROUNDING ();
8498
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74
16557
b0b6262e2d8e frexp* tests: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
75 test_function ();
8498
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 return 0;
accc767de343 Tests for module 'frexpl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 }