HOPS
HOPS class reference
source
cpp_src
Math
include
MHO_CheckForNaN.hh
Go to the documentation of this file.
1
#ifndef MHO_CheckForNaN_HH__
2
#define MHO_CheckForNaN_HH__
3
12
#include <cmath>
13
#include <complex>
14
15
namespace
hops
16
{
17
21
template
<
typename
XNumericalType >
class
MHO_CheckForNaN
22
{
23
public
:
24
MHO_CheckForNaN
();
25
virtual
~MHO_CheckForNaN
();
26
27
35
static
bool
isnan
(
const
XNumericalType&
value
) {
return
value
!=
value
; }
36
37
private
:
38
};
39
40
//overloads for numerical types
41
48
template
<>
inline
bool
MHO_CheckForNaN< float >::isnan
(
const
float
&
value
)
49
{
50
return
std::isnan(
value
);
51
}
52
59
template
<>
inline
bool
MHO_CheckForNaN< double >::isnan
(
const
double
&
value
)
60
{
61
return
std::isnan(
value
);
62
}
63
70
template
<>
inline
bool
MHO_CheckForNaN< long double >::isnan
(
const
long
double
&
value
)
71
{
72
return
std::isnan(
value
);
73
}
74
81
template
<>
inline
bool
MHO_CheckForNaN< std::complex< float >
>::isnan(
const
std::complex< float >&
value
)
82
{
83
return
std::isnan(
value
.real()) || std::isnan(
value
.imag());
84
}
85
92
template
<>
inline
bool
MHO_CheckForNaN< std::complex< double >
>::isnan(
const
std::complex< double >&
value
)
93
{
94
return
std::isnan(
value
.real()) || std::isnan(
value
.imag());
95
}
96
103
template
<>
inline
bool
MHO_CheckForNaN< std::complex< long double >
>::isnan(
const
std::complex< long double >&
value
)
104
{
105
return
std::isnan(
value
.real()) || std::isnan(
value
.imag());
106
}
107
108
109
}
//end of namespace
110
111
#endif
MHO_CheckForNaN
checks if a value is NaN for various numerical types
hops::MHO_CheckForNaN
Class MHO_CheckForNaN.
Definition:
MHO_CheckForNaN.hh:22
hops::MHO_CheckForNaN::~MHO_CheckForNaN
virtual ~MHO_CheckForNaN()
hops::MHO_CheckForNaN::isnan
static bool isnan(const XNumericalType &value)
Checks if a numerical value is NaN by comparing it to itself. note that this primitive (X !...
Definition:
MHO_CheckForNaN.hh:35
hops::MHO_CheckForNaN::MHO_CheckForNaN
MHO_CheckForNaN()
hops
Definition:
MHO_ChannelLabeler.hh:17
value
Definition:
vex.h:175
Generated on Thu Jul 31 2025 19:34:19 for HOPS by
1.9.1