| 1 | // { dg-do run { target c++11 } } |
| 2 | // { dg-require-c-std "" } |
| 3 | // { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" } |
| 4 | // { dg-add-options ieee } |
| 5 | // { dg-skip-if "no extensions in strict dialects" { *-*-* } { "-std=c++*" } } |
| 6 | |
| 7 | // Copyright (C) 2016-2025 Free Software Foundation, Inc. |
| 8 | // |
| 9 | // This file is part of the GNU ISO C++ Library. This library is free |
| 10 | // software; you can redistribute it and/or modify it under the |
| 11 | // terms of the GNU General Public License as published by the |
| 12 | // Free Software Foundation; either version 3, or (at your option) |
| 13 | // any later version. |
| 14 | // |
| 15 | // This library is distributed in the hope that it will be useful, |
| 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | // GNU General Public License for more details. |
| 19 | // |
| 20 | // You should have received a copy of the GNU General Public License along |
| 21 | // with this library; see the file COPYING3. If not see |
| 22 | // <http://www.gnu.org/licenses/>. |
| 23 | |
| 24 | // hyperg |
| 25 | |
| 26 | #include <cmath> |
| 27 | #include <testsuite_hooks.h> |
| 28 | |
| 29 | void |
| 30 | test01() |
| 31 | { |
| 32 | float af = std::numeric_limits<float>::quiet_NaN(); |
| 33 | double ad = std::numeric_limits<double>::quiet_NaN(); |
| 34 | long double al = std::numeric_limits<long double>::quiet_NaN(); |
| 35 | |
| 36 | float bf = 10.0F; |
| 37 | double bd = 10.0; |
| 38 | long double bl = 10.0L; |
| 39 | |
| 40 | float cf = 3.0F; |
| 41 | double cd = 3.0; |
| 42 | long double cl = 3.0L; |
| 43 | |
| 44 | float xf = 0.5F; |
| 45 | double xd = 0.5; |
| 46 | long double xl = 0.5L; |
| 47 | |
| 48 | float a = __gnu_cxx::hyperg(af, bf, cf, xf); |
| 49 | float b = __gnu_cxx::hypergf(af, bf, cf, xf); |
| 50 | double c = __gnu_cxx::hyperg(ad, bd, cd, xd); |
| 51 | long double d = __gnu_cxx::hyperg(al, bl, cl, xl); |
| 52 | long double e = __gnu_cxx::hypergl(al, bl, cl, xl); |
| 53 | |
| 54 | VERIFY(std::isnan(a)); |
| 55 | VERIFY(std::isnan(b)); |
| 56 | VERIFY(std::isnan(c)); |
| 57 | VERIFY(std::isnan(d)); |
| 58 | VERIFY(std::isnan(e)); |
| 59 | |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | void |
| 64 | test02() |
| 65 | { |
| 66 | float af = 2.0F; |
| 67 | double ad = 2.0; |
| 68 | long double al = 2.0L; |
| 69 | |
| 70 | float bf = std::numeric_limits<float>::quiet_NaN(); |
| 71 | double bd = std::numeric_limits<double>::quiet_NaN(); |
| 72 | long double bl = std::numeric_limits<long double>::quiet_NaN(); |
| 73 | |
| 74 | float cf = 3.0F; |
| 75 | double cd = 3.0; |
| 76 | long double cl = 3.0L; |
| 77 | |
| 78 | float xf = 0.5F; |
| 79 | double xd = 0.5; |
| 80 | long double xl = 0.5L; |
| 81 | |
| 82 | float a = __gnu_cxx::hyperg(af, bf, cf, xf); |
| 83 | float b = __gnu_cxx::hypergf(af, bf, cf, xf); |
| 84 | double c = __gnu_cxx::hyperg(ad, bd, cd, xd); |
| 85 | long double d = __gnu_cxx::hyperg(al, bl, cl, xl); |
| 86 | long double e = __gnu_cxx::hypergl(al, bl, cl, xl); |
| 87 | |
| 88 | VERIFY(std::isnan(a)); |
| 89 | VERIFY(std::isnan(b)); |
| 90 | VERIFY(std::isnan(c)); |
| 91 | VERIFY(std::isnan(d)); |
| 92 | VERIFY(std::isnan(e)); |
| 93 | |
| 94 | return; |
| 95 | } |
| 96 | |
| 97 | void |
| 98 | test03() |
| 99 | { |
| 100 | float af = 2.0F; |
| 101 | double ad = 2.0; |
| 102 | long double al = 2.0L; |
| 103 | |
| 104 | float bf = 10.0F; |
| 105 | double bd = 10.0; |
| 106 | long double bl = 10.0L; |
| 107 | |
| 108 | float cf = std::numeric_limits<float>::quiet_NaN(); |
| 109 | double cd = std::numeric_limits<double>::quiet_NaN(); |
| 110 | long double cl = std::numeric_limits<long double>::quiet_NaN(); |
| 111 | |
| 112 | float xf = 0.5F; |
| 113 | double xd = 0.5; |
| 114 | long double xl = 0.5L; |
| 115 | |
| 116 | float a = __gnu_cxx::hyperg(af, bf, cf, xf); |
| 117 | float b = __gnu_cxx::hypergf(af, bf, cf, xf); |
| 118 | double c = __gnu_cxx::hyperg(ad, bd, cd, xd); |
| 119 | long double d = __gnu_cxx::hyperg(al, bl, cl, xl); |
| 120 | long double e = __gnu_cxx::hypergl(al, bl, cl, xl); |
| 121 | |
| 122 | VERIFY(std::isnan(a)); |
| 123 | VERIFY(std::isnan(b)); |
| 124 | VERIFY(std::isnan(c)); |
| 125 | VERIFY(std::isnan(d)); |
| 126 | VERIFY(std::isnan(e)); |
| 127 | |
| 128 | return; |
| 129 | } |
| 130 | |
| 131 | void |
| 132 | test04() |
| 133 | { |
| 134 | float af = 2.0F; |
| 135 | double ad = 2.0; |
| 136 | long double al = 2.0L; |
| 137 | |
| 138 | float bf = 10.0F; |
| 139 | double bd = 10.0; |
| 140 | long double bl = 10.0L; |
| 141 | |
| 142 | float cf = 3.0F; |
| 143 | double cd = 3.0; |
| 144 | long double cl = 3.0L; |
| 145 | |
| 146 | float xf = std::numeric_limits<float>::quiet_NaN(); |
| 147 | double xd = std::numeric_limits<double>::quiet_NaN(); |
| 148 | long double xl = std::numeric_limits<long double>::quiet_NaN(); |
| 149 | |
| 150 | float a = __gnu_cxx::hyperg(af, bf, cf, xf); |
| 151 | float b = __gnu_cxx::hypergf(af, bf, cf, xf); |
| 152 | double c = __gnu_cxx::hyperg(ad, bd, cd, xd); |
| 153 | long double d = __gnu_cxx::hyperg(al, bl, cl, xl); |
| 154 | long double e = __gnu_cxx::hypergl(al, bl, cl, xl); |
| 155 | |
| 156 | VERIFY(std::isnan(a)); |
| 157 | VERIFY(std::isnan(b)); |
| 158 | VERIFY(std::isnan(c)); |
| 159 | VERIFY(std::isnan(d)); |
| 160 | VERIFY(std::isnan(e)); |
| 161 | |
| 162 | return; |
| 163 | } |
| 164 | |
| 165 | int |
| 166 | main() |
| 167 | { |
| 168 | test01(); |
| 169 | test02(); |
| 170 | test03(); |
| 171 | test04(); |
| 172 | return 0; |
| 173 | } |
| 174 |