Geomi
Geomi
src
Common
utils.hpp
1
#ifndef DEF_COMMON_UTILS
2
#define DEF_COMMON_UTILS
3
4
#include <limits>
5
#include <cmath>
6
7
const
double
BERNOULLI_NUMBERS[] = {
8
1.0,
/* 0 */
9
-1.0/2.0,
10
1.0/6.0,
11
0.0,
12
-1.0/30.0,
/* 5 */
13
0.0,
14
1.0/42.0,
15
0.0,
16
-1.0/30.0,
17
0.0,
18
5.0/66.0,
/* 10 */
19
0.0,
20
-691.0/2730.0,
21
0.0,
22
7.0/6.0,
23
0.0,
/* 15 */
24
-3617.0/510.0,
25
0.0,
26
43867.0/798.0,
27
0.0,
28
-174611.0/330.0
/* 20 */
29
};
30
31
// Voir https://www.boost.org/doc/libs/1_61_0/libs/math/doc/html/math_toolkit/float_comparison.html
32
template
<
typename
T_SCALAR_TYPE>
33
bool
34
isZero (T_SCALAR_TYPE d)
35
{
36
return
(std::abs(d)<std::numeric_limits<T_SCALAR_TYPE>::epsilon());
37
}
38
39
template
bool
isZero (
double
);
40
41
template
<
typename
T>
42
class
CRTP
{
43
public
:
44
T& underlying() {
return
static_cast<
T&
>
(*this); }
45
T
const
& underlying()
const
{
return
static_cast<
T const&
>
(*this); }
46
};
47
48
49
#endif
CRTP
Definition:
utils.hpp:42
Generated by
1.8.13