| 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 compile { target c++23 } } |
| 19 | |
| 20 | #include <numbers> |
| 21 | #include <stdfloat> |
| 22 | |
| 23 | #if defined(__STDCPP_FLOAT16_T__) |
| 24 | void |
| 25 | test01() |
| 26 | { |
| 27 | const std::float16_t* d1 = &std::numbers::e_v<std::float16_t>; |
| 28 | const std::float16_t* d2 = &std::numbers::log2e_v<std::float16_t>; |
| 29 | const std::float16_t* d3 = &std::numbers::log10e_v<std::float16_t>; |
| 30 | const std::float16_t* d4 = &std::numbers::pi_v<std::float16_t>; |
| 31 | const std::float16_t* d5 = &std::numbers::inv_pi_v<std::float16_t>; |
| 32 | const std::float16_t* d6 = &std::numbers::inv_sqrtpi_v<std::float16_t>; |
| 33 | const std::float16_t* d7 = &std::numbers::ln2_v<std::float16_t>; |
| 34 | const std::float16_t* d8 = &std::numbers::ln10_v<std::float16_t>; |
| 35 | const std::float16_t* d9 = &std::numbers::sqrt2_v<std::float16_t>; |
| 36 | const std::float16_t* d10 = &std::numbers::sqrt3_v<std::float16_t>; |
| 37 | const std::float16_t* d11 = &std::numbers::inv_sqrt3_v<std::float16_t>; |
| 38 | const std::float16_t* d12 = &std::numbers::egamma_v<std::float16_t>; |
| 39 | const std::float16_t* d13 = &std::numbers::phi_v<std::float16_t>; |
| 40 | } |
| 41 | #endif |
| 42 | |
| 43 | #if defined(__STDCPP_FLOAT32_T__) |
| 44 | void |
| 45 | test02() |
| 46 | { |
| 47 | const std::float32_t* d1 = &std::numbers::e_v<std::float32_t>; |
| 48 | const std::float32_t* d2 = &std::numbers::log2e_v<std::float32_t>; |
| 49 | const std::float32_t* d3 = &std::numbers::log10e_v<std::float32_t>; |
| 50 | const std::float32_t* d4 = &std::numbers::pi_v<std::float32_t>; |
| 51 | const std::float32_t* d5 = &std::numbers::inv_pi_v<std::float32_t>; |
| 52 | const std::float32_t* d6 = &std::numbers::inv_sqrtpi_v<std::float32_t>; |
| 53 | const std::float32_t* d7 = &std::numbers::ln2_v<std::float32_t>; |
| 54 | const std::float32_t* d8 = &std::numbers::ln10_v<std::float32_t>; |
| 55 | const std::float32_t* d9 = &std::numbers::sqrt2_v<std::float32_t>; |
| 56 | const std::float32_t* d10 = &std::numbers::sqrt3_v<std::float32_t>; |
| 57 | const std::float32_t* d11 = &std::numbers::inv_sqrt3_v<std::float32_t>; |
| 58 | const std::float32_t* d12 = &std::numbers::egamma_v<std::float32_t>; |
| 59 | const std::float32_t* d13 = &std::numbers::phi_v<std::float32_t>; |
| 60 | } |
| 61 | #endif |
| 62 | |
| 63 | #if defined(__STDCPP_FLOAT64_T__) |
| 64 | void |
| 65 | test03() |
| 66 | { |
| 67 | const std::float64_t* d1 = &std::numbers::e_v<std::float64_t>; |
| 68 | const std::float64_t* d2 = &std::numbers::log2e_v<std::float64_t>; |
| 69 | const std::float64_t* d3 = &std::numbers::log10e_v<std::float64_t>; |
| 70 | const std::float64_t* d4 = &std::numbers::pi_v<std::float64_t>; |
| 71 | const std::float64_t* d5 = &std::numbers::inv_pi_v<std::float64_t>; |
| 72 | const std::float64_t* d6 = &std::numbers::inv_sqrtpi_v<std::float64_t>; |
| 73 | const std::float64_t* d7 = &std::numbers::ln2_v<std::float64_t>; |
| 74 | const std::float64_t* d8 = &std::numbers::ln10_v<std::float64_t>; |
| 75 | const std::float64_t* d9 = &std::numbers::sqrt2_v<std::float64_t>; |
| 76 | const std::float64_t* d10 = &std::numbers::sqrt3_v<std::float64_t>; |
| 77 | const std::float64_t* d11 = &std::numbers::inv_sqrt3_v<std::float64_t>; |
| 78 | const std::float64_t* d12 = &std::numbers::egamma_v<std::float64_t>; |
| 79 | const std::float64_t* d13 = &std::numbers::phi_v<std::float64_t>; |
| 80 | } |
| 81 | #endif |
| 82 | |
| 83 | #if defined(__STDCPP_FLOAT128_T__) |
| 84 | void |
| 85 | test04() |
| 86 | { |
| 87 | const std::float128_t* d1 = &std::numbers::e_v<std::float128_t>; |
| 88 | const std::float128_t* d2 = &std::numbers::log2e_v<std::float128_t>; |
| 89 | const std::float128_t* d3 = &std::numbers::log10e_v<std::float128_t>; |
| 90 | const std::float128_t* d4 = &std::numbers::pi_v<std::float128_t>; |
| 91 | const std::float128_t* d5 = &std::numbers::inv_pi_v<std::float128_t>; |
| 92 | const std::float128_t* d6 = &std::numbers::inv_sqrtpi_v<std::float128_t>; |
| 93 | const std::float128_t* d7 = &std::numbers::ln2_v<std::float128_t>; |
| 94 | const std::float128_t* d8 = &std::numbers::ln10_v<std::float128_t>; |
| 95 | const std::float128_t* d9 = &std::numbers::sqrt2_v<std::float128_t>; |
| 96 | const std::float128_t* d10 = &std::numbers::sqrt3_v<std::float128_t>; |
| 97 | const std::float128_t* d11 = &std::numbers::inv_sqrt3_v<std::float128_t>; |
| 98 | const std::float128_t* d12 = &std::numbers::egamma_v<std::float128_t>; |
| 99 | const std::float128_t* d13 = &std::numbers::phi_v<std::float128_t>; |
| 100 | } |
| 101 | #endif |
| 102 | |
| 103 | #if defined(__STDCPP_BFLOAT16_T__) |
| 104 | void |
| 105 | test05() |
| 106 | { |
| 107 | const std::bfloat16_t* d1 = &std::numbers::e_v<std::bfloat16_t>; |
| 108 | const std::bfloat16_t* d2 = &std::numbers::log2e_v<std::bfloat16_t>; |
| 109 | const std::bfloat16_t* d3 = &std::numbers::log10e_v<std::bfloat16_t>; |
| 110 | const std::bfloat16_t* d4 = &std::numbers::pi_v<std::bfloat16_t>; |
| 111 | const std::bfloat16_t* d5 = &std::numbers::inv_pi_v<std::bfloat16_t>; |
| 112 | const std::bfloat16_t* d6 = &std::numbers::inv_sqrtpi_v<std::bfloat16_t>; |
| 113 | const std::bfloat16_t* d7 = &std::numbers::ln2_v<std::bfloat16_t>; |
| 114 | const std::bfloat16_t* d8 = &std::numbers::ln10_v<std::bfloat16_t>; |
| 115 | const std::bfloat16_t* d9 = &std::numbers::sqrt2_v<std::bfloat16_t>; |
| 116 | const std::bfloat16_t* d10 = &std::numbers::sqrt3_v<std::bfloat16_t>; |
| 117 | const std::bfloat16_t* d11 = &std::numbers::inv_sqrt3_v<std::bfloat16_t>; |
| 118 | const std::bfloat16_t* d12 = &std::numbers::egamma_v<std::bfloat16_t>; |
| 119 | const std::bfloat16_t* d13 = &std::numbers::phi_v<std::bfloat16_t>; |
| 120 | } |
| 121 | #endif |