1 /* Test totalorderl and totalordermagl for ldbl-96.
2 Copyright (C) 2016-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
21 #include <math_ldbl.h>
26 static const uint64_t tests
[] =
28 0, 1, 0x4000000000000000ULL
, 0x4000000000000001ULL
,
37 if (LDBL_MIN_EXP
== -16382)
38 for (size_t i
= 0; i
< sizeof (tests
) / sizeof (tests
[0]); i
++)
40 long double ldx
, ldy
, ldnx
, ldny
;
41 /* Verify that the high bit of the mantissa is ignored for
42 infinities and NaNs for the M68K variant of this
44 SET_LDOUBLE_WORDS (ldx
, 0x7fff,
45 tests
[i
] >> 32, tests
[i
] & 0xffffffffULL
);
46 SET_LDOUBLE_WORDS (ldy
, 0x7fff,
47 (tests
[i
] >> 32) | 0x80000000,
48 tests
[i
] & 0xffffffffULL
);
49 SET_LDOUBLE_WORDS (ldnx
, 0xffff,
50 tests
[i
] >> 32, tests
[i
] & 0xffffffffULL
);
51 SET_LDOUBLE_WORDS (ldny
, 0xffff,
52 (tests
[i
] >> 32) | 0x80000000,
53 tests
[i
] & 0xffffffffULL
);
54 bool to1
= totalorderl (ldx
, ldy
);
55 bool to2
= totalorderl (ldy
, ldx
);
56 bool to3
= totalorderl (ldnx
, ldny
);
57 bool to4
= totalorderl (ldny
, ldnx
);
58 if (to1
&& to2
&& to3
&& to4
)
59 printf ("PASS: test %zu\n", i
);
62 printf ("FAIL: test %zu\n", i
);
65 to1
= totalordermagl (ldx
, ldy
);
66 to2
= totalordermagl (ldy
, ldx
);
67 to3
= totalordermagl (ldnx
, ldny
);
68 to4
= totalordermagl (ldny
, ldnx
);
69 if (to1
&& to2
&& to3
&& to4
)
70 printf ("PASS: test %zu (totalordermagl)\n", i
);
73 printf ("FAIL: test %zu (totalordermagl)\n", i
);
81 #define TEST_FUNCTION do_test ()
82 #include "../test-skeleton.c"