cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
pi.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_FUNCTIONS_PI_H
4#define pRC_CORE_VALUE_FUNCTIONS_PI_H
5
8
9namespace pRC
10{
11 template<class T, If<IsFloat<T>> = 0>
12 static inline constexpr T pi()
13 {
14 if constexpr(typename T::Width() == 16)
15 {
16 return BFloat16::FromRepresentation(0x4049);
17 }
18 else
19 {
20 return 3.141592653589793238462643383279502884;
21 }
22 }
23
24 template<class T, If<IsInteger<T>> = 0>
25 static inline constexpr auto pi()
26 {
27 return pi<Float<>>();
28 }
29}
30#endif // pRC_CORE_VALUE_FUNCTIONS_PI_H
static constexpr auto FromRepresentation(Representation const rep)
Definition bfloat16.hpp:26
pRC::Constant< Size, W > Width
Definition float.hpp:39
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
static constexpr T pi()
Definition pi.hpp:12