-
Notifications
You must be signed in to change notification settings - Fork 14
/
const.hh
64 lines (57 loc) · 1.37 KB
/
const.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
Some constants
Constants below are the result of truncating the output of "bc -l" computed with "scale=100".
Copyright 2018 Ahmet Inan <[email protected]>
*/
#pragma once
namespace DSP {
template <typename T>
struct Const
{
static constexpr T EighthPi()
{
// a(1)/2
return .3926990816987241548078304229099378605246461749218882276218680740384L;
}
static constexpr T FourthPi()
{
// a(1)
return .7853981633974483096156608458198757210492923498437764552437361480769L;
}
static constexpr T HalfPi()
{
// 2*a(1)
return 1.570796326794896619231321691639751442098584699687552910487472296153L;
}
static constexpr T Pi()
{
// 4*a(1)
return 3.141592653589793238462643383279502884197169399375105820974944592307L;
}
static constexpr T TwoPi()
{
// 8*a(1)
return 6.283185307179586476925286766559005768394338798750211641949889184615L;
}
static constexpr T FourPi()
{
// 16*a(1)
return 12.56637061435917295385057353311801153678867759750042328389977836923L;
}
static constexpr T SqrtPi()
{
// sqrt(4*a(1))
return 1.772453850905516027298167483341145182797549456122387128213807789852L;
}
static constexpr T SqrtTwoPi()
{
// sqrt(8*a(1))
return 2.506628274631000502415765284811045253006986740609938316629923576342L;
}
static constexpr T InvSqrtTwo()
{
// sqrt(2)/2
return .7071067811865475244008443621048490392848359376884740365883398689953L;
}
};
}