CMS 3D CMS Logo

isFinite.h
Go to the documentation of this file.
1 #ifndef FWCORE_Utilities_isFinite_H
2 #define FWCORE_Utilities_isFinite_H
3 
4 namespace edm {
5  template <typename T>
6  constexpr bool isFinite(T x);
7 
8  template <typename T>
9  constexpr bool isNotFinite(T x) {
10  return !isFinite(x);
11  }
12 
13  template <>
14  constexpr bool isFinite(float x) {
15  const unsigned int mask = 0x7f800000;
16  union {
17  unsigned int l;
18  float d;
19  } v = {.d = x};
20  return (v.l & mask) != mask;
21  }
22 
23  template <>
24  constexpr bool isFinite(double x) {
25  const unsigned long long mask = 0x7FF0000000000000LL;
26  union {
27  unsigned long long l;
28  double d;
29  } v = {.d = x};
30  return (v.l & mask) != mask;
31  }
32 
33  template <>
34  constexpr bool isFinite(long double x) {
35  double xx = x;
36  return isFinite(xx);
37  }
38 
39 } // namespace edm
40 
41 #endif // FWCORE_Utilities_isFinite_H
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
edm
HLT enums.
Definition: AlignableModifier.h:19
findQualityFiles.v
v
Definition: findQualityFiles.py:179
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
L1DTConfigBti_cff.LL
LL
Definition: L1DTConfigBti_cff.py:25
T
long double T
Definition: Basic3DVectorLD.h:48
ztail.d
d
Definition: ztail.py:151
edm::isFinite
constexpr bool isFinite(T x)
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19