Home | History | Annotate | Line # | Download | only in include
      1  1.1  joerg // -*- C++ -*-
      2  1.1  joerg //===---------------------------- numbers ---------------------------------===//
      3  1.1  joerg //
      4  1.1  joerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
      5  1.1  joerg // See https://llvm.org/LICENSE.txt for license information.
      6  1.1  joerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
      7  1.1  joerg //
      8  1.1  joerg //===----------------------------------------------------------------------===//
      9  1.1  joerg 
     10  1.1  joerg #ifndef _LIBCPP_NUMBERS
     11  1.1  joerg #define _LIBCPP_NUMBERS
     12  1.1  joerg 
     13  1.1  joerg /*
     14  1.1  joerg     numbers synopsis
     15  1.1  joerg 
     16  1.1  joerg namespace std::numbers {
     17  1.1  joerg   template<class T> inline constexpr T e_v          = unspecified;
     18  1.1  joerg   template<class T> inline constexpr T log2e_v      = unspecified;
     19  1.1  joerg   template<class T> inline constexpr T log10e_v     = unspecified;
     20  1.1  joerg   template<class T> inline constexpr T pi_v         = unspecified;
     21  1.1  joerg   template<class T> inline constexpr T inv_pi_v     = unspecified;
     22  1.1  joerg   template<class T> inline constexpr T inv_sqrtpi_v = unspecified;
     23  1.1  joerg   template<class T> inline constexpr T ln2_v        = unspecified;
     24  1.1  joerg   template<class T> inline constexpr T ln10_v       = unspecified;
     25  1.1  joerg   template<class T> inline constexpr T sqrt2_v      = unspecified;
     26  1.1  joerg   template<class T> inline constexpr T sqrt3_v      = unspecified;
     27  1.1  joerg   template<class T> inline constexpr T inv_sqrt3_v  = unspecified;
     28  1.1  joerg   template<class T> inline constexpr T egamma_v     = unspecified;
     29  1.1  joerg   template<class T> inline constexpr T phi_v        = unspecified;
     30  1.1  joerg 
     31  1.1  joerg   template<floating_point T> inline constexpr T e_v<T>          = see below;
     32  1.1  joerg   template<floating_point T> inline constexpr T log2e_v<T>      = see below;
     33  1.1  joerg   template<floating_point T> inline constexpr T log10e_v<T>     = see below;
     34  1.1  joerg   template<floating_point T> inline constexpr T pi_v<T>         = see below;
     35  1.1  joerg   template<floating_point T> inline constexpr T inv_pi_v<T>     = see below;
     36  1.1  joerg   template<floating_point T> inline constexpr T inv_sqrtpi_v<T> = see below;
     37  1.1  joerg   template<floating_point T> inline constexpr T ln2_v<T>        = see below;
     38  1.1  joerg   template<floating_point T> inline constexpr T ln10_v<T>       = see below;
     39  1.1  joerg   template<floating_point T> inline constexpr T sqrt2_v<T>      = see below;
     40  1.1  joerg   template<floating_point T> inline constexpr T sqrt3_v<T>      = see below;
     41  1.1  joerg   template<floating_point T> inline constexpr T inv_sqrt3_v<T>  = see below;
     42  1.1  joerg   template<floating_point T> inline constexpr T egamma_v<T>     = see below;
     43  1.1  joerg   template<floating_point T> inline constexpr T phi_v<T>        = see below;
     44  1.1  joerg 
     45  1.1  joerg   inline constexpr double e          = e_v<double>;
     46  1.1  joerg   inline constexpr double log2e      = log2e_v<double>;
     47  1.1  joerg   inline constexpr double log10e     = log10e_v<double>;
     48  1.1  joerg   inline constexpr double pi         = pi_v<double>;
     49  1.1  joerg   inline constexpr double inv_pi     = inv_pi_v<double>;
     50  1.1  joerg   inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>;
     51  1.1  joerg   inline constexpr double ln2        = ln2_v<double>;
     52  1.1  joerg   inline constexpr double ln10       = ln10_v<double>;
     53  1.1  joerg   inline constexpr double sqrt2      = sqrt2_v<double>;
     54  1.1  joerg   inline constexpr double sqrt3      = sqrt3_v<double>;
     55  1.1  joerg   inline constexpr double inv_sqrt3  = inv_sqrt3_v<double>;
     56  1.1  joerg   inline constexpr double egamma     = egamma_v<double>;
     57  1.1  joerg   inline constexpr double phi        = phi_v<double>;
     58  1.1  joerg }
     59  1.1  joerg */
     60  1.1  joerg 
     61  1.1  joerg #include <__config>
     62  1.1  joerg 
     63  1.1  joerg #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
     64  1.1  joerg 
     65  1.1  joerg #include <concepts>
     66  1.1  joerg #include <type_traits>
     67  1.1  joerg #include <version>
     68  1.1  joerg 
     69  1.1  joerg #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
     70  1.1  joerg #pragma GCC system_header
     71  1.1  joerg #endif
     72  1.1  joerg 
     73  1.1  joerg _LIBCPP_PUSH_MACROS
     74  1.1  joerg #include <__undef_macros>
     75  1.1  joerg 
     76  1.1  joerg _LIBCPP_BEGIN_NAMESPACE_STD
     77  1.1  joerg 
     78  1.1  joerg namespace numbers {
     79  1.1  joerg 
     80  1.1  joerg template <class T>
     81  1.1  joerg inline constexpr bool __false = false;
     82  1.1  joerg 
     83  1.1  joerg template <class T>
     84  1.1  joerg struct __illformed
     85  1.1  joerg {
     86  1.1  joerg   static_assert(__false<T>, "A program that instantiates a primary template of a mathematical constant variable template is ill-formed.");
     87  1.1  joerg };
     88  1.1  joerg 
     89  1.1  joerg template <class T> inline constexpr T e_v =          __illformed<T>{};
     90  1.1  joerg template <class T> inline constexpr T log2e_v =      __illformed<T>{};
     91  1.1  joerg template <class T> inline constexpr T log10e_v =     __illformed<T>{};
     92  1.1  joerg template <class T> inline constexpr T pi_v =         __illformed<T>{};
     93  1.1  joerg template <class T> inline constexpr T inv_pi_v =     __illformed<T>{};
     94  1.1  joerg template <class T> inline constexpr T inv_sqrtpi_v = __illformed<T>{};
     95  1.1  joerg template <class T> inline constexpr T ln2_v =        __illformed<T>{};
     96  1.1  joerg template <class T> inline constexpr T ln10_v =       __illformed<T>{};
     97  1.1  joerg template <class T> inline constexpr T sqrt2_v =      __illformed<T>{};
     98  1.1  joerg template <class T> inline constexpr T sqrt3_v =      __illformed<T>{};
     99  1.1  joerg template <class T> inline constexpr T inv_sqrt3_v =  __illformed<T>{};
    100  1.1  joerg template <class T> inline constexpr T egamma_v =     __illformed<T>{};
    101  1.1  joerg template <class T> inline constexpr T phi_v =        __illformed<T>{};
    102  1.1  joerg 
    103  1.1  joerg template <floating_point T> inline constexpr T e_v<T>          = 2.718281828459045235360287471352662;
    104  1.1  joerg template <floating_point T> inline constexpr T log2e_v<T>      = 1.442695040888963407359924681001892;
    105  1.1  joerg template <floating_point T> inline constexpr T log10e_v<T>     = 0.434294481903251827651128918916605;
    106  1.1  joerg template <floating_point T> inline constexpr T pi_v<T>         = 3.141592653589793238462643383279502;
    107  1.1  joerg template <floating_point T> inline constexpr T inv_pi_v<T>     = 0.318309886183790671537767526745028;
    108  1.1  joerg template <floating_point T> inline constexpr T inv_sqrtpi_v<T> = 0.564189583547756286948079451560772;
    109  1.1  joerg template <floating_point T> inline constexpr T ln2_v<T>        = 0.693147180559945309417232121458176;
    110  1.1  joerg template <floating_point T> inline constexpr T ln10_v<T>       = 2.302585092994045684017991454684364;
    111  1.1  joerg template <floating_point T> inline constexpr T sqrt2_v<T>      = 1.414213562373095048801688724209698;
    112  1.1  joerg template <floating_point T> inline constexpr T sqrt3_v<T>      = 1.732050807568877293527446341505872;
    113  1.1  joerg template <floating_point T> inline constexpr T inv_sqrt3_v<T>  = 0.577350269189625764509148780501957;
    114  1.1  joerg template <floating_point T> inline constexpr T egamma_v<T>     = 0.577215664901532860606512090082402;
    115  1.1  joerg template <floating_point T> inline constexpr T phi_v<T>        = 1.618033988749894848204586834365638;
    116  1.1  joerg 
    117  1.1  joerg inline constexpr double e          = e_v<double>;
    118  1.1  joerg inline constexpr double log2e      = log2e_v<double>;
    119  1.1  joerg inline constexpr double log10e     = log10e_v<double>;
    120  1.1  joerg inline constexpr double pi         = pi_v<double>;
    121  1.1  joerg inline constexpr double inv_pi     = inv_pi_v<double>;
    122  1.1  joerg inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>;
    123  1.1  joerg inline constexpr double ln2        = ln2_v<double>;
    124  1.1  joerg inline constexpr double ln10       = ln10_v<double>;
    125  1.1  joerg inline constexpr double sqrt2      = sqrt2_v<double>;
    126  1.1  joerg inline constexpr double sqrt3      = sqrt3_v<double>;
    127  1.1  joerg inline constexpr double inv_sqrt3  = inv_sqrt3_v<double>;
    128  1.1  joerg inline constexpr double egamma     = egamma_v<double>;
    129  1.1  joerg inline constexpr double phi        = phi_v<double>;
    130  1.1  joerg 
    131  1.1  joerg } // namespace numbers
    132  1.1  joerg 
    133  1.1  joerg _LIBCPP_END_NAMESPACE_STD
    134  1.1  joerg 
    135  1.1  joerg _LIBCPP_POP_MACROS
    136  1.1  joerg 
    137  1.1  joerg #endif //_LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
    138  1.1  joerg 
    139  1.1  joerg #endif // _LIBCPP_NUMBERS
    140