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() { 154f6c4b47SRaul Tambre assert(std::numbers::e == 0x1.5bf0a8b145769p+1); 164f6c4b47SRaul Tambre assert(std::numbers::e_v<double> == 0x1.5bf0a8b145769p+1); 174f6c4b47SRaul Tambre assert(std::numbers::e_v<long double> == 0x1.5bf0a8b145769p+1l); 184f6c4b47SRaul Tambre assert(std::numbers::e_v<float> == 0x1.5bf0a8p+1f); 194f6c4b47SRaul Tambre 204f6c4b47SRaul Tambre assert(std::numbers::log2e == 0x1.71547652b82fep+0); 214f6c4b47SRaul Tambre assert(std::numbers::log2e_v<double> == 0x1.71547652b82fep+0); 224f6c4b47SRaul Tambre assert(std::numbers::log2e_v<long double> == 0x1.71547652b82fep+0l); 234f6c4b47SRaul Tambre assert(std::numbers::log2e_v<float> == 0x1.715476p+0f); 244f6c4b47SRaul Tambre 254f6c4b47SRaul Tambre assert(std::numbers::log10e == 0x1.bcb7b1526e50ep-2); 264f6c4b47SRaul Tambre assert(std::numbers::log10e_v<double> == 0x1.bcb7b1526e50ep-2); 274f6c4b47SRaul Tambre assert(std::numbers::log10e_v<long double> == 0x1.bcb7b1526e50ep-2l); 284f6c4b47SRaul Tambre assert(std::numbers::log10e_v<float> == 0x1.bcb7b15p-2f); 294f6c4b47SRaul Tambre 304f6c4b47SRaul Tambre assert(std::numbers::pi == 0x1.921fb54442d18p+1); 314f6c4b47SRaul Tambre assert(std::numbers::pi_v<double> == 0x1.921fb54442d18p+1); 324f6c4b47SRaul Tambre assert(std::numbers::pi_v<long double> == 0x1.921fb54442d18p+1l); 334f6c4b47SRaul Tambre assert(std::numbers::pi_v<float> == 0x1.921fb54p+1f); 344f6c4b47SRaul Tambre 354f6c4b47SRaul Tambre assert(std::numbers::inv_pi == 0x1.45f306dc9c883p-2); 364f6c4b47SRaul Tambre assert(std::numbers::inv_pi_v<double> == 0x1.45f306dc9c883p-2); 374f6c4b47SRaul Tambre assert(std::numbers::inv_pi_v<long double> == 0x1.45f306dc9c883p-2l); 384f6c4b47SRaul Tambre assert(std::numbers::inv_pi_v<float> == 0x1.45f306p-2f); 394f6c4b47SRaul Tambre 404f6c4b47SRaul Tambre assert(std::numbers::inv_sqrtpi == 0x1.20dd750429b6dp-1); 414f6c4b47SRaul Tambre assert(std::numbers::inv_sqrtpi_v<double> == 0x1.20dd750429b6dp-1); 424f6c4b47SRaul Tambre assert(std::numbers::inv_sqrtpi_v<long double> == 0x1.20dd750429b6dp-1l); 434f6c4b47SRaul Tambre assert(std::numbers::inv_sqrtpi_v<float> == 0x1.20dd76p-1f); 444f6c4b47SRaul Tambre 454f6c4b47SRaul Tambre assert(std::numbers::ln2 == 0x1.62e42fefa39efp-1); 464f6c4b47SRaul Tambre assert(std::numbers::ln2_v<double> == 0x1.62e42fefa39efp-1); 474f6c4b47SRaul Tambre assert(std::numbers::ln2_v<long double> == 0x1.62e42fefa39efp-1l); 484f6c4b47SRaul Tambre assert(std::numbers::ln2_v<float> == 0x1.62e42fp-1f); 494f6c4b47SRaul Tambre 504f6c4b47SRaul Tambre assert(std::numbers::ln10 == 0x1.26bb1bbb55516p+1); 514f6c4b47SRaul Tambre assert(std::numbers::ln10_v<double> == 0x1.26bb1bbb55516p+1); 524f6c4b47SRaul Tambre assert(std::numbers::ln10_v<long double> == 0x1.26bb1bbb55516p+1l); 534f6c4b47SRaul Tambre assert(std::numbers::ln10_v<float> == 0x1.26bb1bp+1f); 544f6c4b47SRaul Tambre 554f6c4b47SRaul Tambre assert(std::numbers::sqrt2 == 0x1.6a09e667f3bcdp+0); 564f6c4b47SRaul Tambre assert(std::numbers::sqrt2_v<double> == 0x1.6a09e667f3bcdp+0); 574f6c4b47SRaul Tambre assert(std::numbers::sqrt2_v<long double> == 0x1.6a09e667f3bcdp+0l); 584f6c4b47SRaul Tambre assert(std::numbers::sqrt2_v<float> == 0x1.6a09e6p+0f); 594f6c4b47SRaul Tambre 604f6c4b47SRaul Tambre assert(std::numbers::sqrt3 == 0x1.bb67ae8584caap+0); 614f6c4b47SRaul Tambre assert(std::numbers::sqrt3_v<double> == 0x1.bb67ae8584caap+0); 624f6c4b47SRaul Tambre assert(std::numbers::sqrt3_v<long double> == 0x1.bb67ae8584caap+0l); 634f6c4b47SRaul Tambre assert(std::numbers::sqrt3_v<float> == 0x1.bb67aep+0f); 644f6c4b47SRaul Tambre 654f6c4b47SRaul Tambre assert(std::numbers::inv_sqrt3 == 0x1.279a74590331cp-1); 664f6c4b47SRaul Tambre assert(std::numbers::inv_sqrt3_v<double> == 0x1.279a74590331cp-1); 674f6c4b47SRaul Tambre assert(std::numbers::inv_sqrt3_v<long double> == 0x1.279a74590331cp-1l); 684f6c4b47SRaul Tambre assert(std::numbers::inv_sqrt3_v<float> == 0x1.279a74p-1f); 694f6c4b47SRaul Tambre 704f6c4b47SRaul Tambre assert(std::numbers::egamma == 0x1.2788cfc6fb619p-1); 714f6c4b47SRaul Tambre assert(std::numbers::egamma_v<double> == 0x1.2788cfc6fb619p-1); 724f6c4b47SRaul Tambre assert(std::numbers::egamma_v<long double> == 0x1.2788cfc6fb619p-1l); 734f6c4b47SRaul Tambre assert(std::numbers::egamma_v<float> == 0x1.2788cfp-1f); 744f6c4b47SRaul Tambre 754f6c4b47SRaul Tambre assert(std::numbers::phi == 0x1.9e3779b97f4a8p+0); 764f6c4b47SRaul Tambre assert(std::numbers::phi_v<double> == 0x1.9e3779b97f4a8p+0); 774f6c4b47SRaul Tambre assert(std::numbers::phi_v<long double> == 0x1.9e3779b97f4a8p+0l); 784f6c4b47SRaul Tambre assert(std::numbers::phi_v<float> == 0x1.9e3779ap+0f); 794f6c4b47SRaul Tambre 804f6c4b47SRaul Tambre return true; 814f6c4b47SRaul Tambre } 824f6c4b47SRaul Tambre 834f6c4b47SRaul Tambre static_assert(tests()); 844f6c4b47SRaul Tambre main(int,char **)85*504bc07dSLouis Dionneint main(int, char**) { 86*504bc07dSLouis Dionne tests(); 87*504bc07dSLouis Dionne return 0; 88*504bc07dSLouis Dionne } 89