| 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 | // conf_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 cf = 3.0F; |
| 37 | double cd = 3.0; |
| 38 | long double cl = 3.0L; |
| 39 | |
| 40 | float xf = 0.5F; |
| 41 | double xd = 0.5; |
| 42 | long double xl = 0.5L; |
| 43 | |
| 44 | float a = __gnu_cxx::conf_hyperg(af, cf, xf); |
| 45 | float b = __gnu_cxx::conf_hypergf(af, cf, xf); |
| 46 | double c = __gnu_cxx::conf_hyperg(ad, cd, xd); |
| 47 | long double d = __gnu_cxx::conf_hyperg(al, cl, xl); |
| 48 | long double e = __gnu_cxx::conf_hypergl(al, cl, xl); |
| 49 | |
| 50 | VERIFY(std::isnan(a)); |
| 51 | VERIFY(std::isnan(b)); |
| 52 | VERIFY(std::isnan(c)); |
| 53 | VERIFY(std::isnan(d)); |
| 54 | VERIFY(std::isnan(e)); |
| 55 | |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | void |
| 60 | test02() |
| 61 | { |
| 62 | float af = 2.0F; |
| 63 | double ad = 2.0; |
| 64 | long double al = 2.0L; |
| 65 | |
| 66 | float cf = std::numeric_limits<float>::quiet_NaN(); |
| 67 | double cd = std::numeric_limits<double>::quiet_NaN(); |
| 68 | long double cl = std::numeric_limits<long double>::quiet_NaN(); |
| 69 | |
| 70 | float xf = 0.5F; |
| 71 | double xd = 0.5; |
| 72 | long double xl = 0.5L; |
| 73 | |
| 74 | float a = __gnu_cxx::conf_hyperg(af, cf, xf); |
| 75 | float b = __gnu_cxx::conf_hypergf(af, cf, xf); |
| 76 | double c = __gnu_cxx::conf_hyperg(ad, cd, xd); |
| 77 | long double d = __gnu_cxx::conf_hyperg(al, cl, xl); |
| 78 | long double e = __gnu_cxx::conf_hypergl(al, cl, xl); |
| 79 | |
| 80 | VERIFY(std::isnan(a)); |
| 81 | VERIFY(std::isnan(b)); |
| 82 | VERIFY(std::isnan(c)); |
| 83 | VERIFY(std::isnan(d)); |
| 84 | VERIFY(std::isnan(e)); |
| 85 | |
| 86 | return; |
| 87 | } |
| 88 | |
| 89 | void |
| 90 | test03() |
| 91 | { |
| 92 | float af = 2.0F; |
| 93 | double ad = 2.0; |
| 94 | long double al = 2.0L; |
| 95 | |
| 96 | float cf = 3.0F; |
| 97 | double cd = 3.0; |
| 98 | long double cl = 3.0L; |
| 99 | |
| 100 | float xf = std::numeric_limits<float>::quiet_NaN(); |
| 101 | double xd = std::numeric_limits<double>::quiet_NaN(); |
| 102 | long double xl = std::numeric_limits<long double>::quiet_NaN(); |
| 103 | |
| 104 | float a = __gnu_cxx::conf_hyperg(af, cf, xf); |
| 105 | float b = __gnu_cxx::conf_hypergf(af, cf, xf); |
| 106 | double c = __gnu_cxx::conf_hyperg(ad, cd, xd); |
| 107 | long double d = __gnu_cxx::conf_hyperg(al, cl, xl); |
| 108 | long double e = __gnu_cxx::conf_hypergl(al, cl, xl); |
| 109 | |
| 110 | VERIFY(std::isnan(a)); |
| 111 | VERIFY(std::isnan(b)); |
| 112 | VERIFY(std::isnan(c)); |
| 113 | VERIFY(std::isnan(d)); |
| 114 | VERIFY(std::isnan(e)); |
| 115 | |
| 116 | return; |
| 117 | } |
| 118 | |
| 119 | int |
| 120 | main() |
| 121 | { |
| 122 | test01(); |
| 123 | test02(); |
| 124 | test03(); |
| 125 | return 0; |
| 126 | } |
| 127 |