14f6c4b47SRaul Tambre// -*- C++ -*- 2eb8650a7SLouis Dionne//===----------------------------------------------------------------------===// 34f6c4b47SRaul Tambre// 44f6c4b47SRaul Tambre// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 54f6c4b47SRaul Tambre// See https://llvm.org/LICENSE.txt for license information. 64f6c4b47SRaul Tambre// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 74f6c4b47SRaul Tambre// 84f6c4b47SRaul Tambre//===----------------------------------------------------------------------===// 94f6c4b47SRaul Tambre 104f6c4b47SRaul Tambre#ifndef _LIBCPP_NUMBERS 114f6c4b47SRaul Tambre#define _LIBCPP_NUMBERS 124f6c4b47SRaul Tambre 134f6c4b47SRaul Tambre/* 144f6c4b47SRaul Tambre numbers synopsis 154f6c4b47SRaul Tambre 164f6c4b47SRaul Tambrenamespace std::numbers { 174f6c4b47SRaul Tambre template<class T> inline constexpr T e_v = unspecified; 184f6c4b47SRaul Tambre template<class T> inline constexpr T log2e_v = unspecified; 194f6c4b47SRaul Tambre template<class T> inline constexpr T log10e_v = unspecified; 204f6c4b47SRaul Tambre template<class T> inline constexpr T pi_v = unspecified; 214f6c4b47SRaul Tambre template<class T> inline constexpr T inv_pi_v = unspecified; 224f6c4b47SRaul Tambre template<class T> inline constexpr T inv_sqrtpi_v = unspecified; 234f6c4b47SRaul Tambre template<class T> inline constexpr T ln2_v = unspecified; 244f6c4b47SRaul Tambre template<class T> inline constexpr T ln10_v = unspecified; 254f6c4b47SRaul Tambre template<class T> inline constexpr T sqrt2_v = unspecified; 264f6c4b47SRaul Tambre template<class T> inline constexpr T sqrt3_v = unspecified; 274f6c4b47SRaul Tambre template<class T> inline constexpr T inv_sqrt3_v = unspecified; 284f6c4b47SRaul Tambre template<class T> inline constexpr T egamma_v = unspecified; 294f6c4b47SRaul Tambre template<class T> inline constexpr T phi_v = unspecified; 304f6c4b47SRaul Tambre 314f6c4b47SRaul Tambre template<floating_point T> inline constexpr T e_v<T> = see below; 324f6c4b47SRaul Tambre template<floating_point T> inline constexpr T log2e_v<T> = see below; 334f6c4b47SRaul Tambre template<floating_point T> inline constexpr T log10e_v<T> = see below; 344f6c4b47SRaul Tambre template<floating_point T> inline constexpr T pi_v<T> = see below; 354f6c4b47SRaul Tambre template<floating_point T> inline constexpr T inv_pi_v<T> = see below; 364f6c4b47SRaul Tambre template<floating_point T> inline constexpr T inv_sqrtpi_v<T> = see below; 374f6c4b47SRaul Tambre template<floating_point T> inline constexpr T ln2_v<T> = see below; 384f6c4b47SRaul Tambre template<floating_point T> inline constexpr T ln10_v<T> = see below; 394f6c4b47SRaul Tambre template<floating_point T> inline constexpr T sqrt2_v<T> = see below; 404f6c4b47SRaul Tambre template<floating_point T> inline constexpr T sqrt3_v<T> = see below; 414f6c4b47SRaul Tambre template<floating_point T> inline constexpr T inv_sqrt3_v<T> = see below; 424f6c4b47SRaul Tambre template<floating_point T> inline constexpr T egamma_v<T> = see below; 434f6c4b47SRaul Tambre template<floating_point T> inline constexpr T phi_v<T> = see below; 444f6c4b47SRaul Tambre 454f6c4b47SRaul Tambre inline constexpr double e = e_v<double>; 464f6c4b47SRaul Tambre inline constexpr double log2e = log2e_v<double>; 474f6c4b47SRaul Tambre inline constexpr double log10e = log10e_v<double>; 484f6c4b47SRaul Tambre inline constexpr double pi = pi_v<double>; 494f6c4b47SRaul Tambre inline constexpr double inv_pi = inv_pi_v<double>; 504f6c4b47SRaul Tambre inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>; 514f6c4b47SRaul Tambre inline constexpr double ln2 = ln2_v<double>; 524f6c4b47SRaul Tambre inline constexpr double ln10 = ln10_v<double>; 534f6c4b47SRaul Tambre inline constexpr double sqrt2 = sqrt2_v<double>; 544f6c4b47SRaul Tambre inline constexpr double sqrt3 = sqrt3_v<double>; 554f6c4b47SRaul Tambre inline constexpr double inv_sqrt3 = inv_sqrt3_v<double>; 564f6c4b47SRaul Tambre inline constexpr double egamma = egamma_v<double>; 574f6c4b47SRaul Tambre inline constexpr double phi = phi_v<double>; 584f6c4b47SRaul Tambre} 594f6c4b47SRaul Tambre*/ 604f6c4b47SRaul Tambre 61*b9a2658aSNikolas Klauser#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) 62*b9a2658aSNikolas Klauser# include <__cxx03/numbers> 63*b9a2658aSNikolas Klauser#else 6489b356f0SNikolas Klauser# include <__concepts/arithmetic.h> 654f6c4b47SRaul Tambre# include <__config> 664f6c4b47SRaul Tambre# include <version> 674f6c4b47SRaul Tambre 684f15267dSNikolas Klauser# if _LIBCPP_STD_VER >= 20 69bfbd73f8SArthur O'Dwyer 704f6c4b47SRaul Tambre# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 714f6c4b47SRaul Tambre# pragma GCC system_header 724f6c4b47SRaul Tambre# endif 734f6c4b47SRaul Tambre 744f6c4b47SRaul Tambre_LIBCPP_BEGIN_NAMESPACE_STD 754f6c4b47SRaul Tambre 764f6c4b47SRaul Tambrenamespace numbers { 774f6c4b47SRaul Tambre 78a8f1a715SArthur O'Dwyertemplate <class _Tp> 794f6c4b47SRaul Tambreinline constexpr bool __false = false; 804f6c4b47SRaul Tambre 81a8f1a715SArthur O'Dwyertemplate <class _Tp> 829783f28cSLouis Dionnestruct __illformed { 839783f28cSLouis Dionne static_assert( 849783f28cSLouis Dionne __false<_Tp>, 859783f28cSLouis Dionne "A program that instantiates a primary template of a mathematical constant variable template is ill-formed."); 864f6c4b47SRaul Tambre}; 874f6c4b47SRaul Tambre 889783f28cSLouis Dionnetemplate <class _Tp> 899783f28cSLouis Dionneinline constexpr _Tp e_v = __illformed<_Tp>{}; 909783f28cSLouis Dionnetemplate <class _Tp> 919783f28cSLouis Dionneinline constexpr _Tp log2e_v = __illformed<_Tp>{}; 929783f28cSLouis Dionnetemplate <class _Tp> 939783f28cSLouis Dionneinline constexpr _Tp log10e_v = __illformed<_Tp>{}; 949783f28cSLouis Dionnetemplate <class _Tp> 959783f28cSLouis Dionneinline constexpr _Tp pi_v = __illformed<_Tp>{}; 969783f28cSLouis Dionnetemplate <class _Tp> 979783f28cSLouis Dionneinline constexpr _Tp inv_pi_v = __illformed<_Tp>{}; 989783f28cSLouis Dionnetemplate <class _Tp> 999783f28cSLouis Dionneinline constexpr _Tp inv_sqrtpi_v = __illformed<_Tp>{}; 1009783f28cSLouis Dionnetemplate <class _Tp> 1019783f28cSLouis Dionneinline constexpr _Tp ln2_v = __illformed<_Tp>{}; 1029783f28cSLouis Dionnetemplate <class _Tp> 1039783f28cSLouis Dionneinline constexpr _Tp ln10_v = __illformed<_Tp>{}; 1049783f28cSLouis Dionnetemplate <class _Tp> 1059783f28cSLouis Dionneinline constexpr _Tp sqrt2_v = __illformed<_Tp>{}; 1069783f28cSLouis Dionnetemplate <class _Tp> 1079783f28cSLouis Dionneinline constexpr _Tp sqrt3_v = __illformed<_Tp>{}; 1089783f28cSLouis Dionnetemplate <class _Tp> 1099783f28cSLouis Dionneinline constexpr _Tp inv_sqrt3_v = __illformed<_Tp>{}; 1109783f28cSLouis Dionnetemplate <class _Tp> 1119783f28cSLouis Dionneinline constexpr _Tp egamma_v = __illformed<_Tp>{}; 1129783f28cSLouis Dionnetemplate <class _Tp> 1139783f28cSLouis Dionneinline constexpr _Tp phi_v = __illformed<_Tp>{}; 1144f6c4b47SRaul Tambre 1159783f28cSLouis Dionnetemplate <floating_point _Tp> 1169783f28cSLouis Dionneinline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662; 1179783f28cSLouis Dionnetemplate <floating_point _Tp> 1189783f28cSLouis Dionneinline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892; 1199783f28cSLouis Dionnetemplate <floating_point _Tp> 1209783f28cSLouis Dionneinline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605; 1219783f28cSLouis Dionnetemplate <floating_point _Tp> 1229783f28cSLouis Dionneinline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502; 1239783f28cSLouis Dionnetemplate <floating_point _Tp> 1249783f28cSLouis Dionneinline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028; 1259783f28cSLouis Dionnetemplate <floating_point _Tp> 1269783f28cSLouis Dionneinline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772; 1279783f28cSLouis Dionnetemplate <floating_point _Tp> 1289783f28cSLouis Dionneinline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176; 1299783f28cSLouis Dionnetemplate <floating_point _Tp> 1309783f28cSLouis Dionneinline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364; 1319783f28cSLouis Dionnetemplate <floating_point _Tp> 1329783f28cSLouis Dionneinline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698; 1339783f28cSLouis Dionnetemplate <floating_point _Tp> 1349783f28cSLouis Dionneinline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872; 1359783f28cSLouis Dionnetemplate <floating_point _Tp> 1369783f28cSLouis Dionneinline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957; 1379783f28cSLouis Dionnetemplate <floating_point _Tp> 1389783f28cSLouis Dionneinline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402; 1399783f28cSLouis Dionnetemplate <floating_point _Tp> 1409783f28cSLouis Dionneinline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638; 1414f6c4b47SRaul Tambre 1424f6c4b47SRaul Tambreinline constexpr double e = e_v<double>; 1434f6c4b47SRaul Tambreinline constexpr double log2e = log2e_v<double>; 1444f6c4b47SRaul Tambreinline constexpr double log10e = log10e_v<double>; 1454f6c4b47SRaul Tambreinline constexpr double pi = pi_v<double>; 1464f6c4b47SRaul Tambreinline constexpr double inv_pi = inv_pi_v<double>; 1474f6c4b47SRaul Tambreinline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>; 1484f6c4b47SRaul Tambreinline constexpr double ln2 = ln2_v<double>; 1494f6c4b47SRaul Tambreinline constexpr double ln10 = ln10_v<double>; 1504f6c4b47SRaul Tambreinline constexpr double sqrt2 = sqrt2_v<double>; 1514f6c4b47SRaul Tambreinline constexpr double sqrt3 = sqrt3_v<double>; 1524f6c4b47SRaul Tambreinline constexpr double inv_sqrt3 = inv_sqrt3_v<double>; 1534f6c4b47SRaul Tambreinline constexpr double egamma = egamma_v<double>; 1544f6c4b47SRaul Tambreinline constexpr double phi = phi_v<double>; 1554f6c4b47SRaul Tambre 1564f6c4b47SRaul Tambre} // namespace numbers 1574f6c4b47SRaul Tambre 1584f6c4b47SRaul Tambre_LIBCPP_END_NAMESPACE_STD 1594f6c4b47SRaul Tambre 1604f15267dSNikolas Klauser# endif // _LIBCPP_STD_VER >= 20 1614f6c4b47SRaul Tambre 16289b356f0SNikolas Klauser# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 16389b356f0SNikolas Klauser# include <concepts> 164e99c4906SNikolas Klauser# include <cstddef> 165fafed06bSNikolas Klauser# include <type_traits> 16689b356f0SNikolas Klauser# endif 167*b9a2658aSNikolas Klauser#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) 16889b356f0SNikolas Klauser 1694f6c4b47SRaul Tambre#endif // _LIBCPP_NUMBERS 170