]> git.ipfire.org Git - thirdparty/glibc.git/blame - math/libm-test-significand.inc
Convert Python scripts to Python 3
[thirdparty/glibc.git] / math / libm-test-significand.inc
CommitLineData
5cbb5849 1/* Test significand.
d614a753 2 Copyright (C) 1997-2020 Free Software Foundation, Inc.
5cbb5849
JM
3 This file is part of the GNU C Library.
4
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.
9
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.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
5cbb5849 18
92061bb0
JM
19#include "libm-test-driver.c"
20
5cbb5849
JM
21static const struct test_f_f_data significand_test_data[] =
22 {
3c023dbf 23#if !TEST_FLOATN
5cbb5849
JM
24 /* significand returns the mantissa of the exponential
25 representation. Tests for infinities, zero and NaNs reflect
26 the implementation (including possibility of "inexact" and
27 variations between architectures) rather than any
28 specification. */
29 TEST_f_f (significand, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
30 TEST_f_f (significand, -qnan_value, qnan_value, INVALID_EXCEPTION_OK),
31 TEST_f_f (significand, snan_value, qnan_value, INVALID_EXCEPTION),
32 TEST_f_f (significand, -snan_value, qnan_value, INVALID_EXCEPTION),
33 TEST_f_f (significand, plus_infty, plus_infty, INVALID_EXCEPTION_OK),
34 TEST_f_f (significand, minus_infty, minus_infty, INVALID_EXCEPTION_OK),
35 TEST_f_f (significand, 0, 0, INVALID_EXCEPTION_OK|DIVIDE_BY_ZERO_EXCEPTION_OK),
36 TEST_f_f (significand, minus_zero, minus_zero, INVALID_EXCEPTION_OK|DIVIDE_BY_ZERO_EXCEPTION_OK),
37 TEST_f_f (significand, min_value, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
38 TEST_f_f (significand, -min_value, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
39 TEST_f_f (significand, min_subnorm_value, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
40 TEST_f_f (significand, -min_subnorm_value, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
41 TEST_f_f (significand, 1.0, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
42 TEST_f_f (significand, -1.0, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
43 TEST_f_f (significand, 4.0, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
44 TEST_f_f (significand, -4.0, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
45 TEST_f_f (significand, 6.0, 1.5, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
46 TEST_f_f (significand, -6.0, -1.5, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
47 TEST_f_f (significand, 8.0, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
48 TEST_f_f (significand, -8.0, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
3c023dbf 49#endif
5cbb5849
JM
50 };
51
52static void
53significand_test (void)
54{
3c023dbf 55#if !TEST_FLOATN
5cbb5849 56 ALL_RM_TEST (significand, 1, significand_test_data, RUN_TEST_LOOP_f_f, END);
3c023dbf 57#endif
5cbb5849
JM
58}
59
92061bb0
JM
60static void
61do_test (void)
62{
63 significand_test ();
64}
65
5cbb5849
JM
66/*
67 * Local Variables:
68 * mode:c
69 * End:
70 */