xref: /freebsd/contrib/llvm-project/libcxx/include/numbers (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
15ffd83dbSDimitry Andric// -*- C++ -*-
2*349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
35ffd83dbSDimitry Andric//
45ffd83dbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55ffd83dbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
65ffd83dbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
75ffd83dbSDimitry Andric//
85ffd83dbSDimitry Andric//===----------------------------------------------------------------------===//
95ffd83dbSDimitry Andric
105ffd83dbSDimitry Andric#ifndef _LIBCPP_NUMBERS
115ffd83dbSDimitry Andric#define _LIBCPP_NUMBERS
125ffd83dbSDimitry Andric
135ffd83dbSDimitry Andric/*
145ffd83dbSDimitry Andric    numbers synopsis
155ffd83dbSDimitry Andric
165ffd83dbSDimitry Andricnamespace std::numbers {
175ffd83dbSDimitry Andric  template<class T> inline constexpr T e_v          = unspecified;
185ffd83dbSDimitry Andric  template<class T> inline constexpr T log2e_v      = unspecified;
195ffd83dbSDimitry Andric  template<class T> inline constexpr T log10e_v     = unspecified;
205ffd83dbSDimitry Andric  template<class T> inline constexpr T pi_v         = unspecified;
215ffd83dbSDimitry Andric  template<class T> inline constexpr T inv_pi_v     = unspecified;
225ffd83dbSDimitry Andric  template<class T> inline constexpr T inv_sqrtpi_v = unspecified;
235ffd83dbSDimitry Andric  template<class T> inline constexpr T ln2_v        = unspecified;
245ffd83dbSDimitry Andric  template<class T> inline constexpr T ln10_v       = unspecified;
255ffd83dbSDimitry Andric  template<class T> inline constexpr T sqrt2_v      = unspecified;
265ffd83dbSDimitry Andric  template<class T> inline constexpr T sqrt3_v      = unspecified;
275ffd83dbSDimitry Andric  template<class T> inline constexpr T inv_sqrt3_v  = unspecified;
285ffd83dbSDimitry Andric  template<class T> inline constexpr T egamma_v     = unspecified;
295ffd83dbSDimitry Andric  template<class T> inline constexpr T phi_v        = unspecified;
305ffd83dbSDimitry Andric
315ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T e_v<T>          = see below;
325ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T log2e_v<T>      = see below;
335ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T log10e_v<T>     = see below;
345ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T pi_v<T>         = see below;
355ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T inv_pi_v<T>     = see below;
365ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T inv_sqrtpi_v<T> = see below;
375ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T ln2_v<T>        = see below;
385ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T ln10_v<T>       = see below;
395ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T sqrt2_v<T>      = see below;
405ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T sqrt3_v<T>      = see below;
415ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T inv_sqrt3_v<T>  = see below;
425ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T egamma_v<T>     = see below;
435ffd83dbSDimitry Andric  template<floating_point T> inline constexpr T phi_v<T>        = see below;
445ffd83dbSDimitry Andric
455ffd83dbSDimitry Andric  inline constexpr double e          = e_v<double>;
465ffd83dbSDimitry Andric  inline constexpr double log2e      = log2e_v<double>;
475ffd83dbSDimitry Andric  inline constexpr double log10e     = log10e_v<double>;
485ffd83dbSDimitry Andric  inline constexpr double pi         = pi_v<double>;
495ffd83dbSDimitry Andric  inline constexpr double inv_pi     = inv_pi_v<double>;
505ffd83dbSDimitry Andric  inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>;
515ffd83dbSDimitry Andric  inline constexpr double ln2        = ln2_v<double>;
525ffd83dbSDimitry Andric  inline constexpr double ln10       = ln10_v<double>;
535ffd83dbSDimitry Andric  inline constexpr double sqrt2      = sqrt2_v<double>;
545ffd83dbSDimitry Andric  inline constexpr double sqrt3      = sqrt3_v<double>;
555ffd83dbSDimitry Andric  inline constexpr double inv_sqrt3  = inv_sqrt3_v<double>;
565ffd83dbSDimitry Andric  inline constexpr double egamma     = egamma_v<double>;
575ffd83dbSDimitry Andric  inline constexpr double phi        = phi_v<double>;
585ffd83dbSDimitry Andric}
595ffd83dbSDimitry Andric*/
605ffd83dbSDimitry Andric
615ffd83dbSDimitry Andric#include <__config>
62fe6060f1SDimitry Andric#include <concepts>
635ffd83dbSDimitry Andric#include <type_traits>
645ffd83dbSDimitry Andric#include <version>
655ffd83dbSDimitry Andric
66fe6060f1SDimitry Andric#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
67fe6060f1SDimitry Andric
685ffd83dbSDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
695ffd83dbSDimitry Andric#pragma GCC system_header
705ffd83dbSDimitry Andric#endif
715ffd83dbSDimitry Andric
725ffd83dbSDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD
735ffd83dbSDimitry Andric
745ffd83dbSDimitry Andricnamespace numbers {
755ffd83dbSDimitry Andric
765ffd83dbSDimitry Andrictemplate <class T>
775ffd83dbSDimitry Andricinline constexpr bool __false = false;
785ffd83dbSDimitry Andric
795ffd83dbSDimitry Andrictemplate <class T>
805ffd83dbSDimitry Andricstruct __illformed
815ffd83dbSDimitry Andric{
825ffd83dbSDimitry Andric  static_assert(__false<T>, "A program that instantiates a primary template of a mathematical constant variable template is ill-formed.");
835ffd83dbSDimitry Andric};
845ffd83dbSDimitry Andric
855ffd83dbSDimitry Andrictemplate <class T> inline constexpr T e_v =          __illformed<T>{};
865ffd83dbSDimitry Andrictemplate <class T> inline constexpr T log2e_v =      __illformed<T>{};
875ffd83dbSDimitry Andrictemplate <class T> inline constexpr T log10e_v =     __illformed<T>{};
885ffd83dbSDimitry Andrictemplate <class T> inline constexpr T pi_v =         __illformed<T>{};
895ffd83dbSDimitry Andrictemplate <class T> inline constexpr T inv_pi_v =     __illformed<T>{};
905ffd83dbSDimitry Andrictemplate <class T> inline constexpr T inv_sqrtpi_v = __illformed<T>{};
915ffd83dbSDimitry Andrictemplate <class T> inline constexpr T ln2_v =        __illformed<T>{};
925ffd83dbSDimitry Andrictemplate <class T> inline constexpr T ln10_v =       __illformed<T>{};
935ffd83dbSDimitry Andrictemplate <class T> inline constexpr T sqrt2_v =      __illformed<T>{};
945ffd83dbSDimitry Andrictemplate <class T> inline constexpr T sqrt3_v =      __illformed<T>{};
955ffd83dbSDimitry Andrictemplate <class T> inline constexpr T inv_sqrt3_v =  __illformed<T>{};
965ffd83dbSDimitry Andrictemplate <class T> inline constexpr T egamma_v =     __illformed<T>{};
975ffd83dbSDimitry Andrictemplate <class T> inline constexpr T phi_v =        __illformed<T>{};
985ffd83dbSDimitry Andric
99fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T e_v<T>          = 2.718281828459045235360287471352662;
100fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T log2e_v<T>      = 1.442695040888963407359924681001892;
101fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T log10e_v<T>     = 0.434294481903251827651128918916605;
102fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T pi_v<T>         = 3.141592653589793238462643383279502;
103fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T inv_pi_v<T>     = 0.318309886183790671537767526745028;
104fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T inv_sqrtpi_v<T> = 0.564189583547756286948079451560772;
105fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T ln2_v<T>        = 0.693147180559945309417232121458176;
106fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T ln10_v<T>       = 2.302585092994045684017991454684364;
107fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T sqrt2_v<T>      = 1.414213562373095048801688724209698;
108fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T sqrt3_v<T>      = 1.732050807568877293527446341505872;
109fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T inv_sqrt3_v<T>  = 0.577350269189625764509148780501957;
110fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T egamma_v<T>     = 0.577215664901532860606512090082402;
111fe6060f1SDimitry Andrictemplate <floating_point T> inline constexpr T phi_v<T>        = 1.618033988749894848204586834365638;
1125ffd83dbSDimitry Andric
1135ffd83dbSDimitry Andricinline constexpr double e          = e_v<double>;
1145ffd83dbSDimitry Andricinline constexpr double log2e      = log2e_v<double>;
1155ffd83dbSDimitry Andricinline constexpr double log10e     = log10e_v<double>;
1165ffd83dbSDimitry Andricinline constexpr double pi         = pi_v<double>;
1175ffd83dbSDimitry Andricinline constexpr double inv_pi     = inv_pi_v<double>;
1185ffd83dbSDimitry Andricinline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>;
1195ffd83dbSDimitry Andricinline constexpr double ln2        = ln2_v<double>;
1205ffd83dbSDimitry Andricinline constexpr double ln10       = ln10_v<double>;
1215ffd83dbSDimitry Andricinline constexpr double sqrt2      = sqrt2_v<double>;
1225ffd83dbSDimitry Andricinline constexpr double sqrt3      = sqrt3_v<double>;
1235ffd83dbSDimitry Andricinline constexpr double inv_sqrt3  = inv_sqrt3_v<double>;
1245ffd83dbSDimitry Andricinline constexpr double egamma     = egamma_v<double>;
1255ffd83dbSDimitry Andricinline constexpr double phi        = phi_v<double>;
1265ffd83dbSDimitry Andric
1275ffd83dbSDimitry Andric} // namespace numbers
1285ffd83dbSDimitry Andric
1295ffd83dbSDimitry Andric_LIBCPP_END_NAMESPACE_STD
1305ffd83dbSDimitry Andric
131fe6060f1SDimitry Andric#endif //_LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
1325ffd83dbSDimitry Andric
1335ffd83dbSDimitry Andric#endif // _LIBCPP_NUMBERS
134