Embedded Template Library
1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
math_constants.h
1
/******************************************************************************
2
The MIT License(MIT)
3
4
Embedded Template Library.
5
https://github.com/ETLCPP/etl
6
https://www.etlcpp.com
7
8
Copyright(c) 2018 John Wellbelove
9
10
Permission is hereby granted, free of charge, to any person obtaining a copy
11
of this software and associated documentation files(the "Software"), to deal
12
in the Software without restriction, including without limitation the rights
13
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
14
coPIes of the Software, and to permit persons to whom the Software is
15
furnished to do so, subject to the following conditions :
16
17
The above copyright notice and this permission notice shall be included in all
18
coPIes or substantial portions of the Software.
19
20
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
23
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
SOFTWARE.
27
******************************************************************************/
28
29
#ifndef ETL_MATH_CONSTANTS_INCLUDED
30
#define ETL_MATH_CONSTANTS_INCLUDED
31
32
#include "
platform.h
"
33
34
#include "
private/diagnostic_gnu_static_float_init_push.h
"
35
36
namespace
etl
37
{
38
namespace
private_math_constants
39
{
40
template
<
typename
T =
void
>
41
struct
math_helper
42
{
43
static
ETL_CONSTANT
double
pi = 3.14159265358979;
44
static
ETL_CONSTANT
double
pi_reciprocal = 0.31830988618379;
45
static
ETL_CONSTANT
double
pi_squared = 9.86960440108936;
46
static
ETL_CONSTANT
double
e = 2.71828182845905;
47
static
ETL_CONSTANT
double
e_reciprocal = 0.36787944117144;
48
static
ETL_CONSTANT
double
e_squared = 7.38905609893065;
49
static
ETL_CONSTANT
double
root2 = 1.41421356237310;
50
static
ETL_CONSTANT
double
root2_reciprocal = 0.70710678118655;
51
static
ETL_CONSTANT
double
euler = 0.57721566490153;
52
static
ETL_CONSTANT
double
golden_ratio = 1.61803398874989;
53
};
54
55
template
<
typename
T>
56
ETL_CONSTANT
double
math_helper<T>::pi;
57
58
template
<
typename
T>
59
ETL_CONSTANT
double
math_helper<T>::pi_reciprocal;
60
61
template
<
typename
T>
62
ETL_CONSTANT
double
math_helper<T>::pi_squared;
63
64
template
<
typename
T>
65
ETL_CONSTANT
double
math_helper<T>::e;
66
67
template
<
typename
T>
68
ETL_CONSTANT
double
math_helper<T>::e_reciprocal;
69
70
template
<
typename
T>
71
ETL_CONSTANT
double
math_helper<T>::e_squared;
72
73
template
<
typename
T>
74
ETL_CONSTANT
double
math_helper<T>::root2;
75
76
template
<
typename
T>
77
ETL_CONSTANT
double
math_helper<T>::root2_reciprocal;
78
79
template
<
typename
T>
80
ETL_CONSTANT
double
math_helper<T>::euler;
81
82
template
<
typename
T>
83
ETL_CONSTANT
double
math_helper<T>::golden_ratio;
84
}
// namespace private_math_constants
85
86
struct
math
:
public
private_math_constants::math_helper
<>
87
{
88
};
89
}
// namespace etl
90
91
#include "
private/diagnostic_pop.h
"
92
93
#endif
diagnostic_gnu_static_float_init_push.h
diagnostic_pop.h
etl
Definition
absolute.h:40
platform.h
etl::math
Definition
math_constants.h:87
etl::private_math_constants::math_helper
Definition
math_constants.h:42
include
etl
math_constants.h
Generated on
for Embedded Template Library by
1.17.0