14f6c4b47SRaul Tambre //===----------------------------------------------------------------------===// 24f6c4b47SRaul Tambre // 34f6c4b47SRaul Tambre // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 44f6c4b47SRaul Tambre // See https://llvm.org/LICENSE.txt for license information. 54f6c4b47SRaul Tambre // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 64f6c4b47SRaul Tambre // 74f6c4b47SRaul Tambre //===----------------------------------------------------------------------===// 84f6c4b47SRaul Tambre 9b5e896c0SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14, c++17 104f6c4b47SRaul Tambre 114f6c4b47SRaul Tambre #include <cassert> 124f6c4b47SRaul Tambre #include <numbers> 134f6c4b47SRaul Tambre tests()144f6c4b47SRaul Tambreconstexpr bool tests() { 15*b2091899SCasey Carter [[maybe_unused]] float f0{std::numbers::e_v<float>}; 16*b2091899SCasey Carter [[maybe_unused]] float f1{std::numbers::log2e_v<float>}; 17*b2091899SCasey Carter [[maybe_unused]] float f2{std::numbers::log10e_v<float>}; 18*b2091899SCasey Carter [[maybe_unused]] float f3{std::numbers::pi_v<float>}; 19*b2091899SCasey Carter [[maybe_unused]] float f4{std::numbers::inv_pi_v<float>}; 20*b2091899SCasey Carter [[maybe_unused]] float f5{std::numbers::inv_sqrtpi_v<float>}; 21*b2091899SCasey Carter [[maybe_unused]] float f6{std::numbers::ln2_v<float>}; 22*b2091899SCasey Carter [[maybe_unused]] float f7{std::numbers::ln10_v<float>}; 23*b2091899SCasey Carter [[maybe_unused]] float f8{std::numbers::sqrt2_v<float>}; 24*b2091899SCasey Carter [[maybe_unused]] float f9{std::numbers::sqrt3_v<float>}; 25*b2091899SCasey Carter [[maybe_unused]] float f10{std::numbers::inv_sqrt3_v<float>}; 26*b2091899SCasey Carter [[maybe_unused]] float f11{std::numbers::egamma_v<float>}; 27*b2091899SCasey Carter [[maybe_unused]] float f12{std::numbers::phi_v<float>}; 284f6c4b47SRaul Tambre 294f6c4b47SRaul Tambre double d0{std::numbers::e_v<double>}; 304f6c4b47SRaul Tambre double d1{std::numbers::log2e_v<double>}; 314f6c4b47SRaul Tambre double d2{std::numbers::log10e_v<double>}; 324f6c4b47SRaul Tambre double d3{std::numbers::pi_v<double>}; 334f6c4b47SRaul Tambre double d4{std::numbers::inv_pi_v<double>}; 344f6c4b47SRaul Tambre double d5{std::numbers::inv_sqrtpi_v<double>}; 354f6c4b47SRaul Tambre double d6{std::numbers::ln2_v<double>}; 364f6c4b47SRaul Tambre double d7{std::numbers::ln10_v<double>}; 374f6c4b47SRaul Tambre double d8{std::numbers::sqrt2_v<double>}; 384f6c4b47SRaul Tambre double d9{std::numbers::sqrt3_v<double>}; 394f6c4b47SRaul Tambre double d10{std::numbers::inv_sqrt3_v<double>}; 404f6c4b47SRaul Tambre double d11{std::numbers::egamma_v<double>}; 414f6c4b47SRaul Tambre double d12{std::numbers::phi_v<double>}; 424f6c4b47SRaul Tambre 434f6c4b47SRaul Tambre assert(d0 == std::numbers::e); 444f6c4b47SRaul Tambre assert(d1 == std::numbers::log2e); 454f6c4b47SRaul Tambre assert(d2 == std::numbers::log10e); 464f6c4b47SRaul Tambre assert(d3 == std::numbers::pi); 474f6c4b47SRaul Tambre assert(d4 == std::numbers::inv_pi); 484f6c4b47SRaul Tambre assert(d5 == std::numbers::inv_sqrtpi); 494f6c4b47SRaul Tambre assert(d6 == std::numbers::ln2); 504f6c4b47SRaul Tambre assert(d7 == std::numbers::ln10); 514f6c4b47SRaul Tambre assert(d8 == std::numbers::sqrt2); 524f6c4b47SRaul Tambre assert(d9 == std::numbers::sqrt3); 534f6c4b47SRaul Tambre assert(d10 == std::numbers::inv_sqrt3); 544f6c4b47SRaul Tambre assert(d11 == std::numbers::egamma); 554f6c4b47SRaul Tambre assert(d12 == std::numbers::phi); 564f6c4b47SRaul Tambre 57*b2091899SCasey Carter [[maybe_unused]] long double ld0{std::numbers::e_v<long double>}; 58*b2091899SCasey Carter [[maybe_unused]] long double ld1{std::numbers::log2e_v<long double>}; 59*b2091899SCasey Carter [[maybe_unused]] long double ld2{std::numbers::log10e_v<long double>}; 60*b2091899SCasey Carter [[maybe_unused]] long double ld3{std::numbers::pi_v<long double>}; 61*b2091899SCasey Carter [[maybe_unused]] long double ld4{std::numbers::inv_pi_v<long double>}; 62*b2091899SCasey Carter [[maybe_unused]] long double ld5{std::numbers::inv_sqrtpi_v<long double>}; 63*b2091899SCasey Carter [[maybe_unused]] long double ld6{std::numbers::ln2_v<long double>}; 64*b2091899SCasey Carter [[maybe_unused]] long double ld7{std::numbers::ln10_v<long double>}; 65*b2091899SCasey Carter [[maybe_unused]] long double ld8{std::numbers::sqrt2_v<long double>}; 66*b2091899SCasey Carter [[maybe_unused]] long double ld9{std::numbers::sqrt3_v<long double>}; 67*b2091899SCasey Carter [[maybe_unused]] long double ld10{std::numbers::inv_sqrt3_v<long double>}; 68*b2091899SCasey Carter [[maybe_unused]] long double ld11{std::numbers::egamma_v<long double>}; 69*b2091899SCasey Carter [[maybe_unused]] long double ld12{std::numbers::phi_v<long double>}; 704f6c4b47SRaul Tambre 714f6c4b47SRaul Tambre return true; 724f6c4b47SRaul Tambre } 734f6c4b47SRaul Tambre 744f6c4b47SRaul Tambre static_assert(tests()); 754f6c4b47SRaul Tambre main(int,char **)76504bc07dSLouis Dionneint main(int, char**) { 77504bc07dSLouis Dionne tests(); 78504bc07dSLouis Dionne return 0; 79504bc07dSLouis Dionne } 80