Main Page
Namespaces
Classes
Package Documentation
DataFormats
Math
interface
approx_math.h
Go to the documentation of this file.
1
#ifndef DataFormatsMathApproxMath_H
2
#define DataFormatsMathApproxMath_H
3
4
5
#include <cstdint>
6
#include <cmath>
7
#include <limits>
8
#include <algorithm>
9
10
namespace
approx_math
{
11
// not c++ compliant (only C compliant)
12
// to be c++ compliaint one must use memcpy...
13
union
binary32
{
14
constexpr
binary32
() :
ui32
(0) {};
15
constexpr
binary32
(
float
ff
) :
f
(ff) {};
16
constexpr
binary32
(int32_t
ii
) :
i32
(ii){}
17
constexpr
binary32
(uint32_t
ui
) :
ui32
(ui){}
18
19
uint32_t
ui32
;
/* unsigned int */
20
int32_t
i32
;
/* Signed int */
21
float
f
;
22
};
23
#ifdef __SSE4_1__
24
constexpr
float
fpfloor
(
float
x) {
25
return
std::floor(x);
26
}
27
#else
28
constexpr
float
fpfloor
(
float
x) {
29
int32_t ret = x;
30
binary32
xx
(x);
31
ret-=(xx.
ui32
>>31);
32
return
ret;
33
}
34
#endif
35
}
36
37
#endif
approx_math::binary32::ui32
uint32_t ui32
Definition:
approx_math.h:19
approx_math::binary32::i32
int32_t i32
Definition:
approx_math.h:20
approx_math::binary32::binary32
constexpr binary32(int32_t ii)
Definition:
approx_math.h:16
approx_math::fpfloor
constexpr float fpfloor(float x)
Definition:
approx_math.h:28
alignCSCRings.ff
ff
Definition:
alignCSCRings.py:148
interactiveExample.ui
ui
Definition:
interactiveExample.py:13
approx_math::binary32::binary32
constexpr binary32()
Definition:
approx_math.h:14
approx_math::binary32
Definition:
approx_math.h:13
approx_math::binary32::f
float f
Definition:
approx_math.h:21
approx_math
Definition:
approx_math.h:10
cuy.ii
ii
Definition:
cuy.py:590
geometryCSVtoXML.xx
xx
Definition:
geometryCSVtoXML.py:19
approx_math::binary32::binary32
constexpr binary32(float ff)
Definition:
approx_math.h:15
approx_math::binary32::binary32
constexpr binary32(uint32_t ui)
Definition:
approx_math.h:17
constexpr
#define constexpr
Definition:
GCC11Compatibility.h:35
Generated for CMSSW Reference Manual by
1.8.11