| 1 | // Copyright (C) 2022-2025 Free Software Foundation, Inc. |
| 2 | // |
| 3 | // This file is part of the GNU ISO C++ Library. This library is free |
| 4 | // software; you can redistribute it and/or modify it under the |
| 5 | // terms of the GNU General Public License as published by the |
| 6 | // Free Software Foundation; either version 3, or (at your option) |
| 7 | // any later version. |
| 8 | |
| 9 | // This library is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | |
| 14 | // You should have received a copy of the GNU General Public License along |
| 15 | // with this library; see the file COPYING3. If not see |
| 16 | // <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | // { dg-do link { target c++23 } } |
| 19 | // { dg-require-cmath "" } |
| 20 | |
| 21 | #include <stdfloat> |
| 22 | #include <cmath> |
| 23 | |
| 24 | template <typename T> |
| 25 | __attribute__((__noipa__)) void |
| 26 | test_functions(T *p, int *q, long int *r, long long int *s) |
| 27 | { |
| 28 | p[0] = std::acos(p[0]); |
| 29 | p[1] = std::asin(p[1]); |
| 30 | p[2] = std::atan(p[2]); |
| 31 | p[3] = std::cos(p[3]); |
| 32 | p[4] = std::sin(p[4]); |
| 33 | p[5] = std::tan(p[5]); |
| 34 | p[6] = std::acosh(p[6]); |
| 35 | p[7] = std::asinh(p[7]); |
| 36 | p[8] = std::atanh(p[8]); |
| 37 | p[9] = std::cosh(p[9]); |
| 38 | p[10] = std::sinh(p[10]); |
| 39 | p[11] = std::tanh(p[11]); |
| 40 | p[12] = std::exp(p[12]); |
| 41 | p[13] = std::exp2(p[13]); |
| 42 | p[14] = std::expm1(p[14]); |
| 43 | p[15] = std::log(p[15]); |
| 44 | p[16] = std::log10(p[16]); |
| 45 | p[17] = std::log1p(p[17]); |
| 46 | p[18] = std::log2(p[18]); |
| 47 | p[19] = std::logb(p[19]); |
| 48 | p[20] = std::cbrt(p[20]); |
| 49 | p[21] = std::fabs(p[21]); |
| 50 | p[22] = std::sqrt(p[22]); |
| 51 | p[23] = std::erf(p[23]); |
| 52 | p[24] = std::erfc(p[24]); |
| 53 | p[25] = std::lgamma(p[25]); |
| 54 | p[26] = std::tgamma(p[26]); |
| 55 | p[27] = std::ceil(p[27]); |
| 56 | p[28] = std::floor(p[28]); |
| 57 | p[29] = std::nearbyint(p[29]); |
| 58 | p[30] = std::rint(p[30]); |
| 59 | p[31] = std::round(p[31]); |
| 60 | p[32] = std::trunc(p[32]); |
| 61 | p[33] = std::atan2(p[33], p[100]); |
| 62 | p[34] = std::hypot(p[34], p[101]); |
| 63 | p[35] = std::pow(p[35], p[102]); |
| 64 | p[36] = std::fmod(p[36], p[103]); |
| 65 | p[37] = std::remainder(p[37], p[104]); |
| 66 | p[38] = std::copysign(p[38], p[105]); |
| 67 | p[39] = std::nextafter(p[39], p[106]); |
| 68 | p[40] = std::fdim(p[40], p[107]); |
| 69 | p[41] = std::fmax(p[41], p[108]); |
| 70 | p[42] = std::fmin(p[42], p[109]); |
| 71 | p[43] = std::atan2(p[43], p[110]); |
| 72 | p[44] = std::frexp(p[44], q + 0); |
| 73 | q[1] = std::ilogb(p[45]); |
| 74 | p[46] = std::ldexp(p[46], q[2]); |
| 75 | p[47] = std::modf(p[47], p + 111); |
| 76 | p[48] = std::scalbn(p[48], q[3]); |
| 77 | p[49] = std::scalbln(p[49], r[0]); |
| 78 | p[50] = std::hypot(p[50], p[111], p[112]); |
| 79 | r[1] = std::lrint(p[51]); |
| 80 | s[0] = std::llrint(p[52]); |
| 81 | r[2] = std::lround(p[53]); |
| 82 | s[1] = std::llround(p[54]); |
| 83 | p[55] = std::remquo(p[55], p[113], q + 4); |
| 84 | p[56] = std::fma(p[56], p[114], p[115]); |
| 85 | p[57] = std::lerp(p[57], p[116], p[117]); |
| 86 | p[58] = std::assoc_laguerre(q[5], q[6], p[58]); |
| 87 | p[59] = std::assoc_legendre(q[7], q[8], p[59]); |
| 88 | p[60] = std::beta(p[60], p[118]); |
| 89 | p[61] = std::comp_ellint_1(p[61]); |
| 90 | p[62] = std::comp_ellint_2(p[62]); |
| 91 | p[63] = std::comp_ellint_3(p[63], p[119]); |
| 92 | p[64] = std::cyl_bessel_i(p[64], p[120]); |
| 93 | p[65] = std::cyl_bessel_j(p[65], p[121]); |
| 94 | p[66] = std::cyl_bessel_k(p[66], p[122]); |
| 95 | p[67] = std::cyl_neumann(p[67], p[123]); |
| 96 | p[68] = std::ellint_1(p[68], p[124]); |
| 97 | p[69] = std::ellint_2(p[69], p[125]); |
| 98 | p[70] = std::ellint_3(p[70], p[126], p[127]); |
| 99 | p[71] = std::expint(p[71]); |
| 100 | p[72] = std::hermite(q[9], p[72]); |
| 101 | p[73] = std::laguerre(q[10], p[73]); |
| 102 | p[74] = std::legendre(q[11], p[72]); |
| 103 | p[75] = std::riemann_zeta(p[75]); |
| 104 | p[76] = std::sph_bessel(q[12], p[76]); |
| 105 | p[77] = std::sph_legendre(q[13], q[14], p[77]); |
| 106 | p[78] = std::sph_neumann(q[15], p[78]); |
| 107 | } |
| 108 | |
| 109 | int |
| 110 | main() |
| 111 | { |
| 112 | int q[16] = {}; |
| 113 | long int r[16] = {}; |
| 114 | long long int s[16] = {}; |
| 115 | #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) |
| 116 | { |
| 117 | std::float16_t p[128] = {}; |
| 118 | test_functions(p, q, r, s); |
| 119 | } |
| 120 | #endif |
| 121 | #if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) |
| 122 | { |
| 123 | std::float32_t p[128] = {}; |
| 124 | test_functions(p, q, r, s); |
| 125 | } |
| 126 | #endif |
| 127 | #if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) |
| 128 | { |
| 129 | std::float64_t p[128] = {}; |
| 130 | test_functions(p, q, r, s); |
| 131 | } |
| 132 | #endif |
| 133 | #if defined(__STDCPP_FLOAT128_T__) \ |
| 134 | && (defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) \ |
| 135 | || defined(_GLIBCXX_HAVE_FLOAT128_MATH)) |
| 136 | { |
| 137 | std::float128_t p[128] = {}; |
| 138 | test_functions(p, q, r, s); |
| 139 | } |
| 140 | #endif |
| 141 | #if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) |
| 142 | { |
| 143 | std::bfloat16_t p[128] = {}; |
| 144 | test_functions(p, q, r, s); |
| 145 | } |
| 146 | #endif |
| 147 | } |