pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
prc
core
value
functions
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
6
#include <
prc/core/value/float.hpp
>
7
#include <
prc/core/value/type_traits.hpp
>
8
9
namespace
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
pRC::BFloat16::FromRepresentation
static constexpr auto FromRepresentation(Representation const rep)
Definition
bfloat16.hpp:34
type_traits.hpp
float.hpp
pRC
Definition
cholesky.hpp:18
pRC::pi
static constexpr T pi()
Returns pi as a Float.
Definition
pi.hpp:19
pRC::copy
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition
copy.hpp:13
Generated by
1.9.8