1/* Test hypot. 2 Copyright (C) 1997-2022 Free Software Foundation, Inc. 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 17 <https://www.gnu.org/licenses/>. */ 18 19#include "libm-test-driver.c" 20 21static const struct test_ff_f_data hypot_test_data[] = 22 { 23 TEST_ff_f (hypot, plus_infty, 1, plus_infty, ERRNO_UNCHANGED), 24 TEST_ff_f (hypot, plus_infty, -1, plus_infty, ERRNO_UNCHANGED), 25 TEST_ff_f (hypot, plus_infty, 0, plus_infty, ERRNO_UNCHANGED), 26 TEST_ff_f (hypot, plus_infty, minus_zero, plus_infty, ERRNO_UNCHANGED), 27 TEST_ff_f (hypot, plus_infty, max_value, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC), 28 TEST_ff_f (hypot, plus_infty, -max_value, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC), 29 TEST_ff_f (hypot, plus_infty, min_value, plus_infty, ERRNO_UNCHANGED), 30 TEST_ff_f (hypot, plus_infty, -min_value, plus_infty, ERRNO_UNCHANGED), 31 TEST_ff_f (hypot, plus_infty, min_subnorm_value, plus_infty, ERRNO_UNCHANGED), 32 TEST_ff_f (hypot, plus_infty, -min_subnorm_value, plus_infty, ERRNO_UNCHANGED), 33 TEST_ff_f (hypot, 1, plus_infty, plus_infty, ERRNO_UNCHANGED), 34 TEST_ff_f (hypot, -1, plus_infty, plus_infty, ERRNO_UNCHANGED), 35 TEST_ff_f (hypot, 0, plus_infty, plus_infty, ERRNO_UNCHANGED), 36 TEST_ff_f (hypot, minus_zero, plus_infty, plus_infty, ERRNO_UNCHANGED), 37 TEST_ff_f (hypot, max_value, plus_infty, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC), 38 TEST_ff_f (hypot, -max_value, plus_infty, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC), 39 TEST_ff_f (hypot, min_value, plus_infty, plus_infty, ERRNO_UNCHANGED), 40 TEST_ff_f (hypot, -min_value, plus_infty, plus_infty, ERRNO_UNCHANGED), 41 TEST_ff_f (hypot, min_subnorm_value, plus_infty, plus_infty, ERRNO_UNCHANGED), 42 TEST_ff_f (hypot, -min_subnorm_value, plus_infty, plus_infty, ERRNO_UNCHANGED), 43 TEST_ff_f (hypot, minus_infty, 1, plus_infty, ERRNO_UNCHANGED), 44 TEST_ff_f (hypot, minus_infty, -1, plus_infty, ERRNO_UNCHANGED), 45 TEST_ff_f (hypot, minus_infty, 0, plus_infty, ERRNO_UNCHANGED), 46 TEST_ff_f (hypot, minus_infty, minus_zero, plus_infty, ERRNO_UNCHANGED), 47 TEST_ff_f (hypot, minus_infty, max_value, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC), 48 TEST_ff_f (hypot, minus_infty, -max_value, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC), 49 TEST_ff_f (hypot, minus_infty, min_value, plus_infty, ERRNO_UNCHANGED), 50 TEST_ff_f (hypot, minus_infty, -min_value, plus_infty, ERRNO_UNCHANGED), 51 TEST_ff_f (hypot, minus_infty, min_subnorm_value, plus_infty, ERRNO_UNCHANGED), 52 TEST_ff_f (hypot, minus_infty, -min_subnorm_value, plus_infty, ERRNO_UNCHANGED), 53 TEST_ff_f (hypot, 1, minus_infty, plus_infty, ERRNO_UNCHANGED), 54 TEST_ff_f (hypot, -1, minus_infty, plus_infty, ERRNO_UNCHANGED), 55 TEST_ff_f (hypot, 0, minus_infty, plus_infty, ERRNO_UNCHANGED), 56 TEST_ff_f (hypot, minus_zero, minus_infty, plus_infty, ERRNO_UNCHANGED), 57 TEST_ff_f (hypot, max_value, minus_infty, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC), 58 TEST_ff_f (hypot, -max_value, minus_infty, plus_infty, ERRNO_UNCHANGED|XFAIL_ROUNDING_IBM128_LIBGCC), 59 TEST_ff_f (hypot, min_value, minus_infty, plus_infty, ERRNO_UNCHANGED), 60 TEST_ff_f (hypot, -min_value, minus_infty, plus_infty, ERRNO_UNCHANGED), 61 TEST_ff_f (hypot, min_subnorm_value, minus_infty, plus_infty, ERRNO_UNCHANGED), 62 TEST_ff_f (hypot, -min_subnorm_value, minus_infty, plus_infty, ERRNO_UNCHANGED), 63 TEST_ff_f (hypot, plus_infty, plus_infty, plus_infty, ERRNO_UNCHANGED), 64 TEST_ff_f (hypot, plus_infty, minus_infty, plus_infty, ERRNO_UNCHANGED), 65 TEST_ff_f (hypot, minus_infty, plus_infty, plus_infty, ERRNO_UNCHANGED), 66 TEST_ff_f (hypot, minus_infty, minus_infty, plus_infty, ERRNO_UNCHANGED), 67 68 TEST_ff_f (hypot, plus_infty, qnan_value, plus_infty, ERRNO_UNCHANGED), 69 TEST_ff_f (hypot, plus_infty, -qnan_value, plus_infty, ERRNO_UNCHANGED), 70 TEST_ff_f (hypot, minus_infty, qnan_value, plus_infty, ERRNO_UNCHANGED), 71 TEST_ff_f (hypot, minus_infty, -qnan_value, plus_infty, ERRNO_UNCHANGED), 72 TEST_ff_f (hypot, qnan_value, plus_infty, plus_infty, ERRNO_UNCHANGED), 73 TEST_ff_f (hypot, -qnan_value, plus_infty, plus_infty, ERRNO_UNCHANGED), 74 TEST_ff_f (hypot, qnan_value, minus_infty, plus_infty, ERRNO_UNCHANGED), 75 TEST_ff_f (hypot, -qnan_value, minus_infty, plus_infty, ERRNO_UNCHANGED), 76 TEST_ff_f (hypot, plus_infty, snan_value, qnan_value, INVALID_EXCEPTION), 77 TEST_ff_f (hypot, plus_infty, -snan_value, qnan_value, INVALID_EXCEPTION), 78 TEST_ff_f (hypot, minus_infty, snan_value, qnan_value, INVALID_EXCEPTION), 79 TEST_ff_f (hypot, minus_infty, -snan_value, qnan_value, INVALID_EXCEPTION), 80 TEST_ff_f (hypot, snan_value, plus_infty, qnan_value, INVALID_EXCEPTION), 81 TEST_ff_f (hypot, -snan_value, plus_infty, qnan_value, INVALID_EXCEPTION), 82 TEST_ff_f (hypot, snan_value, minus_infty, qnan_value, INVALID_EXCEPTION), 83 TEST_ff_f (hypot, -snan_value, minus_infty, qnan_value, INVALID_EXCEPTION), 84 85 TEST_ff_f (hypot, 0, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 86 TEST_ff_f (hypot, 0, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 87 TEST_ff_f (hypot, minus_zero, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 88 TEST_ff_f (hypot, minus_zero, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 89 TEST_ff_f (hypot, max_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 90 TEST_ff_f (hypot, max_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 91 TEST_ff_f (hypot, -max_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 92 TEST_ff_f (hypot, -max_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 93 TEST_ff_f (hypot, min_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 94 TEST_ff_f (hypot, min_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 95 TEST_ff_f (hypot, -min_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 96 TEST_ff_f (hypot, -min_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 97 TEST_ff_f (hypot, min_subnorm_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 98 TEST_ff_f (hypot, min_subnorm_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 99 TEST_ff_f (hypot, -min_subnorm_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 100 TEST_ff_f (hypot, -min_subnorm_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 101 TEST_ff_f (hypot, 0, snan_value, qnan_value, INVALID_EXCEPTION), 102 TEST_ff_f (hypot, 0, -snan_value, qnan_value, INVALID_EXCEPTION), 103 TEST_ff_f (hypot, minus_zero, snan_value, qnan_value, INVALID_EXCEPTION), 104 TEST_ff_f (hypot, minus_zero, -snan_value, qnan_value, INVALID_EXCEPTION), 105 TEST_ff_f (hypot, max_value, snan_value, qnan_value, INVALID_EXCEPTION), 106 TEST_ff_f (hypot, max_value, -snan_value, qnan_value, INVALID_EXCEPTION), 107 TEST_ff_f (hypot, -max_value, snan_value, qnan_value, INVALID_EXCEPTION), 108 TEST_ff_f (hypot, -max_value, -snan_value, qnan_value, INVALID_EXCEPTION), 109 TEST_ff_f (hypot, min_value, snan_value, qnan_value, INVALID_EXCEPTION), 110 TEST_ff_f (hypot, min_value, -snan_value, qnan_value, INVALID_EXCEPTION), 111 TEST_ff_f (hypot, -min_value, snan_value, qnan_value, INVALID_EXCEPTION), 112 TEST_ff_f (hypot, -min_value, -snan_value, qnan_value, INVALID_EXCEPTION), 113 TEST_ff_f (hypot, min_subnorm_value, snan_value, qnan_value, INVALID_EXCEPTION), 114 TEST_ff_f (hypot, min_subnorm_value, -snan_value, qnan_value, INVALID_EXCEPTION), 115 TEST_ff_f (hypot, -min_subnorm_value, snan_value, qnan_value, INVALID_EXCEPTION), 116 TEST_ff_f (hypot, -min_subnorm_value, -snan_value, qnan_value, INVALID_EXCEPTION), 117 TEST_ff_f (hypot, qnan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 118 TEST_ff_f (hypot, -qnan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 119 TEST_ff_f (hypot, qnan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 120 TEST_ff_f (hypot, -qnan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 121 TEST_ff_f (hypot, qnan_value, max_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 122 TEST_ff_f (hypot, -qnan_value, max_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 123 TEST_ff_f (hypot, qnan_value, -max_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 124 TEST_ff_f (hypot, -qnan_value, -max_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 125 TEST_ff_f (hypot, qnan_value, min_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 126 TEST_ff_f (hypot, -qnan_value, min_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 127 TEST_ff_f (hypot, qnan_value, -min_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 128 TEST_ff_f (hypot, -qnan_value, -min_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 129 TEST_ff_f (hypot, qnan_value, min_subnorm_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 130 TEST_ff_f (hypot, -qnan_value, min_subnorm_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 131 TEST_ff_f (hypot, qnan_value, -min_subnorm_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 132 TEST_ff_f (hypot, -qnan_value, -min_subnorm_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 133 TEST_ff_f (hypot, snan_value, 0, qnan_value, INVALID_EXCEPTION), 134 TEST_ff_f (hypot, -snan_value, 0, qnan_value, INVALID_EXCEPTION), 135 TEST_ff_f (hypot, snan_value, minus_zero, qnan_value, INVALID_EXCEPTION), 136 TEST_ff_f (hypot, -snan_value, minus_zero, qnan_value, INVALID_EXCEPTION), 137 TEST_ff_f (hypot, snan_value, max_value, qnan_value, INVALID_EXCEPTION), 138 TEST_ff_f (hypot, -snan_value, max_value, qnan_value, INVALID_EXCEPTION), 139 TEST_ff_f (hypot, snan_value, -max_value, qnan_value, INVALID_EXCEPTION), 140 TEST_ff_f (hypot, -snan_value, -max_value, qnan_value, INVALID_EXCEPTION), 141 TEST_ff_f (hypot, snan_value, min_value, qnan_value, INVALID_EXCEPTION), 142 TEST_ff_f (hypot, -snan_value, min_value, qnan_value, INVALID_EXCEPTION), 143 TEST_ff_f (hypot, snan_value, -min_value, qnan_value, INVALID_EXCEPTION), 144 TEST_ff_f (hypot, -snan_value, -min_value, qnan_value, INVALID_EXCEPTION), 145 TEST_ff_f (hypot, snan_value, min_subnorm_value, qnan_value, INVALID_EXCEPTION), 146 TEST_ff_f (hypot, -snan_value, min_subnorm_value, qnan_value, INVALID_EXCEPTION), 147 TEST_ff_f (hypot, snan_value, -min_subnorm_value, qnan_value, INVALID_EXCEPTION), 148 TEST_ff_f (hypot, -snan_value, -min_subnorm_value, qnan_value, INVALID_EXCEPTION), 149 150 TEST_ff_f (hypot, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 151 TEST_ff_f (hypot, qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 152 TEST_ff_f (hypot, -qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 153 TEST_ff_f (hypot, -qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED), 154 TEST_ff_f (hypot, qnan_value, snan_value, qnan_value, INVALID_EXCEPTION), 155 TEST_ff_f (hypot, qnan_value, -snan_value, qnan_value, INVALID_EXCEPTION), 156 TEST_ff_f (hypot, -qnan_value, snan_value, qnan_value, INVALID_EXCEPTION), 157 TEST_ff_f (hypot, -qnan_value, -snan_value, qnan_value, INVALID_EXCEPTION), 158 TEST_ff_f (hypot, snan_value, qnan_value, qnan_value, INVALID_EXCEPTION), 159 TEST_ff_f (hypot, snan_value, -qnan_value, qnan_value, INVALID_EXCEPTION), 160 TEST_ff_f (hypot, -snan_value, qnan_value, qnan_value, INVALID_EXCEPTION), 161 TEST_ff_f (hypot, -snan_value, -qnan_value, qnan_value, INVALID_EXCEPTION), 162 TEST_ff_f (hypot, snan_value, snan_value, qnan_value, INVALID_EXCEPTION), 163 TEST_ff_f (hypot, snan_value, -snan_value, qnan_value, INVALID_EXCEPTION), 164 TEST_ff_f (hypot, -snan_value, snan_value, qnan_value, INVALID_EXCEPTION), 165 TEST_ff_f (hypot, -snan_value, -snan_value, qnan_value, INVALID_EXCEPTION), 166 167 AUTO_TESTS_ff_f (hypot), 168 }; 169 170static void 171hypot_test (void) 172{ 173 ALL_RM_TEST (hypot, 0, hypot_test_data, RUN_TEST_LOOP_ff_f, END); 174} 175 176static void 177do_test (void) 178{ 179 hypot_test (); 180} 181 182/* 183 * Local Variables: 184 * mode:c 185 * End: 186 */ 187