pRC
multi-purpose Tensor Train library for C++
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{
18 template<class T, If<IsFloat<T>> = 0>
19 static inline constexpr T pi()
20 {
21 if constexpr(typename T::Width() == 16)
22 {
23 return BFloat16::FromRepresentation(0x4049);
24 }
25 else
26 {
27 return 3.141592653589793238462643383279502884;
28 }
29 }
30
38 template<class T, If<IsInteger<T>> = 0>
39 static inline constexpr auto pi()
40 {
41 return pi<Float<>>();
42 }
43}
44#endif // pRC_CORE_VALUE_FUNCTIONS_PI_H
static constexpr auto FromRepresentation(Representation const rep)
Definition bfloat16.hpp:34
Definition cholesky.hpp:18
static constexpr T pi()
Returns pi as a Float.
Definition pi.hpp:19
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13