aboutsummaryrefslogtreecommitdiff
path: root/math/libm-test-compoundn.inc
blob: 828a5d0c3902cf27dcd1ec3c3a19dbbefa04e401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* Test compoundn.
   Copyright (C) 2025 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <https://www.gnu.org/licenses/>.  */

#include "libm-test-driver.c"

static const struct test_fL_f_data compoundn_test_data[] =
  {
    TEST_fL_f (compoundn, qnan_value, 0, 1, ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, -qnan_value, 0, 1, ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, snan_value, 0, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -snan_value, 0, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, plus_infty, 0, 1, ERRNO_UNCHANGED),

    TEST_fL_f (compoundn, qnan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, -qnan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, snan_value, 1, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -snan_value, 1, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, qnan_value, -1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, -qnan_value, -1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, snan_value, -1, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -snan_value, -1, qnan_value, INVALID_EXCEPTION),

    TEST_fL_f (compoundn, qnan_value, 3, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, -qnan_value, 3, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, qnan_value, -3, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, -qnan_value, -3, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, snan_value, 3, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -snan_value, 3, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, snan_value, -3, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -snan_value, -3, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, qnan_value, LLONG_MAX, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, -qnan_value, LLONG_MAX, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, snan_value, LLONG_MAX, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -snan_value, LLONG_MAX, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, qnan_value, LLONG_MIN, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, -qnan_value, LLONG_MIN, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, snan_value, LLONG_MIN, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -snan_value, LLONG_MIN, qnan_value, INVALID_EXCEPTION),

    TEST_fL_f (compoundn, -1.001, 0, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -1.001, 1, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -1.001, -1, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -1.001, 2, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -1.001, -2, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -1.001, LLONG_MAX, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -1.001, LLONG_MIN, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -max_value, 0, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -max_value, 1, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -max_value, -1, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -max_value, 2, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -max_value, -2, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -max_value, LLONG_MAX, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, -max_value, LLONG_MIN, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, minus_infty, 0, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, minus_infty, 1, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, minus_infty, -1, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, minus_infty, 2, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, minus_infty, -2, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, minus_infty, LLONG_MAX, qnan_value, INVALID_EXCEPTION),
    TEST_fL_f (compoundn, minus_infty, LLONG_MIN, qnan_value, INVALID_EXCEPTION),

    TEST_fL_f (compoundn, -1.0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
    TEST_fL_f (compoundn, -1.0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
    TEST_fL_f (compoundn, -1.0, LLONG_MIN, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),

    TEST_fL_f (compoundn, plus_infty, 1, plus_infty, ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, plus_infty, 2, plus_infty, ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, plus_infty, LLONG_MAX, plus_infty, ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, plus_infty, -1, plus_zero, ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, plus_infty, -2, plus_zero, ERRNO_UNCHANGED),
    TEST_fL_f (compoundn, plus_infty, LLONG_MIN, plus_zero, ERRNO_UNCHANGED),

    AUTO_TESTS_fL_f (compoundn),
  };

static void
compoundn_test (void)
{
  ALL_RM_TEST (compoundn, 0, compoundn_test_data, RUN_TEST_LOOP_fL_f, END);
}

static void
do_test (void)
{
  compoundn_test ();
}

/*
 * Local Variables:
 * mode:c
 * End:
 */