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*385cc25aSLouis Dionne#include <__assert> // all public C++ headers provide the assertion handler
624f6c4b47SRaul Tambre#include <__config>
63e4dd614aSChristopher Di Bella#include <concepts>
644f6c4b47SRaul Tambre#include <type_traits>
654f6c4b47SRaul Tambre#include <version>
664f6c4b47SRaul Tambre
67d2baefaeSJoe Loser#if _LIBCPP_STD_VER > 17
68bfbd73f8SArthur O'Dwyer
694f6c4b47SRaul Tambre#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
704f6c4b47SRaul Tambre#  pragma GCC system_header
714f6c4b47SRaul Tambre#endif
724f6c4b47SRaul Tambre
734f6c4b47SRaul Tambre_LIBCPP_BEGIN_NAMESPACE_STD
744f6c4b47SRaul Tambre
754f6c4b47SRaul Tambrenamespace numbers {
764f6c4b47SRaul Tambre
77a8f1a715SArthur O'Dwyertemplate <class _Tp>
784f6c4b47SRaul Tambreinline constexpr bool __false = false;
794f6c4b47SRaul Tambre
80a8f1a715SArthur O'Dwyertemplate <class _Tp>
814f6c4b47SRaul Tambrestruct __illformed
824f6c4b47SRaul Tambre{
83a8f1a715SArthur O'Dwyer  static_assert(__false<_Tp>, "A program that instantiates a primary template of a mathematical constant variable template is ill-formed.");
844f6c4b47SRaul Tambre};
854f6c4b47SRaul Tambre
86a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp e_v =          __illformed<_Tp>{};
87a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp log2e_v =      __illformed<_Tp>{};
88a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp log10e_v =     __illformed<_Tp>{};
89a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp pi_v =         __illformed<_Tp>{};
90a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp inv_pi_v =     __illformed<_Tp>{};
91a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp inv_sqrtpi_v = __illformed<_Tp>{};
92a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp ln2_v =        __illformed<_Tp>{};
93a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp ln10_v =       __illformed<_Tp>{};
94a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp sqrt2_v =      __illformed<_Tp>{};
95a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp sqrt3_v =      __illformed<_Tp>{};
96a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp inv_sqrt3_v =  __illformed<_Tp>{};
97a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp egamma_v =     __illformed<_Tp>{};
98a8f1a715SArthur O'Dwyertemplate <class _Tp> inline constexpr _Tp phi_v =        __illformed<_Tp>{};
994f6c4b47SRaul Tambre
100a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp e_v<_Tp>          = 2.718281828459045235360287471352662;
101a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp log2e_v<_Tp>      = 1.442695040888963407359924681001892;
102a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp log10e_v<_Tp>     = 0.434294481903251827651128918916605;
103a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp pi_v<_Tp>         = 3.141592653589793238462643383279502;
104a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp inv_pi_v<_Tp>     = 0.318309886183790671537767526745028;
105a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772;
106a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp ln2_v<_Tp>        = 0.693147180559945309417232121458176;
107a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp ln10_v<_Tp>       = 2.302585092994045684017991454684364;
108a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp sqrt2_v<_Tp>      = 1.414213562373095048801688724209698;
109a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp sqrt3_v<_Tp>      = 1.732050807568877293527446341505872;
110a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp inv_sqrt3_v<_Tp>  = 0.577350269189625764509148780501957;
111a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp egamma_v<_Tp>     = 0.577215664901532860606512090082402;
112a8f1a715SArthur O'Dwyertemplate <floating_point _Tp> inline constexpr _Tp phi_v<_Tp>        = 1.618033988749894848204586834365638;
1134f6c4b47SRaul Tambre
1144f6c4b47SRaul Tambreinline constexpr double e          = e_v<double>;
1154f6c4b47SRaul Tambreinline constexpr double log2e      = log2e_v<double>;
1164f6c4b47SRaul Tambreinline constexpr double log10e     = log10e_v<double>;
1174f6c4b47SRaul Tambreinline constexpr double pi         = pi_v<double>;
1184f6c4b47SRaul Tambreinline constexpr double inv_pi     = inv_pi_v<double>;
1194f6c4b47SRaul Tambreinline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>;
1204f6c4b47SRaul Tambreinline constexpr double ln2        = ln2_v<double>;
1214f6c4b47SRaul Tambreinline constexpr double ln10       = ln10_v<double>;
1224f6c4b47SRaul Tambreinline constexpr double sqrt2      = sqrt2_v<double>;
1234f6c4b47SRaul Tambreinline constexpr double sqrt3      = sqrt3_v<double>;
1244f6c4b47SRaul Tambreinline constexpr double inv_sqrt3  = inv_sqrt3_v<double>;
1254f6c4b47SRaul Tambreinline constexpr double egamma     = egamma_v<double>;
1264f6c4b47SRaul Tambreinline constexpr double phi        = phi_v<double>;
1274f6c4b47SRaul Tambre
1284f6c4b47SRaul Tambre} // namespace numbers
1294f6c4b47SRaul Tambre
1304f6c4b47SRaul Tambre_LIBCPP_END_NAMESPACE_STD
1314f6c4b47SRaul Tambre
132d2baefaeSJoe Loser#endif // _LIBCPP_STD_VER > 17
1334f6c4b47SRaul Tambre
1344f6c4b47SRaul Tambre#endif // _LIBCPP_NUMBERS
135