47 template<
typename _Tp>
inline bool isNotZero(_Tp value)
55 if (fabs(value) < std::numeric_limits<float32>::epsilon())
64 if (fabs(value) < std::numeric_limits<float64>::epsilon())
73 if (fabs(value.real()) < std::numeric_limits<float32>::epsilon() &&
74 fabs(value.imag()) < std::numeric_limits<float32>::epsilon())
83 if (fabs(value.real()) < std::numeric_limits<float64>::epsilon() &&
84 fabs(value.imag()) < std::numeric_limits<float64>::epsilon())
109 unsigned char *ch = (
unsigned char *)&value;
110 return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0x80) != 0x80;
116 unsigned char *ch = (
unsigned char *)&value;
117 return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0;
123 float32 realVal = value.real();
124 float32 imagVal = value.imag();
125 unsigned char *chreal = (
unsigned char *)&realVal;
126 unsigned char *chimag = (
unsigned char *)&imagVal;
127 return ((chreal[3] & 0x7f) != 0x7f || (chreal[2] & 0x80) != 0x80) && ((chimag[3] & 0x7f) != 0x7f || (chimag[2] & 0x80) != 0x80);
133 float64 realVal = value.real();
134 float64 imagVal = value.imag();
135 unsigned char *chreal = (
unsigned char *)&realVal;
136 unsigned char *chimag = (
unsigned char *)&imagVal;
137 return ((chreal[7] & 0x7f) != 0x7f || (chreal[6] & 0xf0) != 0xf0) && ((chimag[7] & 0x7f) != 0x7f || (chimag[6] & 0xf0) != 0xf0);
150 template<
typename _Tp>
inline bool isNaN(_Tp value)
158 unsigned char *ch = (
unsigned char *)&value;
159 return (ch[3] & 0x7f) == 0x7f && ch[2] > 0x80;
164 unsigned char *ch = (
unsigned char *)&value;
165 return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0;
171 float32 realVal = value.real();
172 float32 imagVal = value.imag();
173 unsigned char *chreal = (
unsigned char *)&realVal;
174 unsigned char *chimag = (
unsigned char *)&imagVal;
175 return ((chreal[3] & 0x7f) == 0x7f && chreal[2] > 0x80) || ((chimag[3] & 0x7f) == 0x7f && chimag[2] > 0x80);
181 float64 realVal = value.real();
182 float64 imagVal = value.imag();
183 unsigned char *chreal = (
unsigned char *)&realVal;
184 unsigned char *chimag = (
unsigned char *)&imagVal;
185 return ((chreal[7] & 0x7f) == 0x7f && chreal[6] > 0xf0) || ((chimag[7] & 0x7f) == 0x7f && chimag[6] > 0xf0);
198 template<
typename _Tp>
inline bool isInf(_Tp )
206 unsigned char *ch = (
unsigned char *)&value;
207 return (ch[3] & 0x7f) == 0x7f && ch[2] == 0x80;
213 unsigned char *ch = (
unsigned char *)&value;
214 return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0;
220 float32 realVal = value.real();
221 float32 imagVal = value.imag();
222 unsigned char *chreal = (
unsigned char *)&realVal;
223 unsigned char *chimag = (
unsigned char *)&imagVal;
224 return ((chreal[3] & 0x7f) == 0x7f && chreal[2] == 0x80) || ((chimag[3] & 0x7f) == 0x7f && chimag[2] == 0x80);
230 float64 realVal = value.real();
231 float64 imagVal = value.imag();
232 unsigned char *chreal = (
unsigned char *)&realVal;
233 unsigned char *chimag = (
unsigned char *)&imagVal;
234 return ((chreal[7] & 0x7f) == 0x7f && chreal[6] == 0xf0) || ((chimag[7] & 0x7f) == 0x7f && chimag[6] == 0xf0);
253 template<>
inline bool isZeroValue(Rgba32 v, Rgba32 )
255 return v == Rgba32::zeros();
258 template<>
inline bool isZeroValue(float32 v, float32 epsilon)
260 return v >= epsilon ? false : (v <= -epsilon ? false :
true);
263 template<>
inline bool isZeroValue(float64 v, float64 epsilon)
265 return v >= epsilon ? false : (v <= -epsilon ? false :
true);
268 template<>
inline bool isZeroValue(std::complex<ito::float32> v, std::complex<ito::float32> epsilon)
273 template<>
inline bool isZeroValue(std::complex<ito::float64> v, std::complex<ito::float64> epsilon)
283 template<
typename _Tp>
inline bool areEqual(_Tp a, _Tp b)
289 template<>
inline bool areEqual(float32 a, float32 b)
291 return fabs(a - b) < std::numeric_limits<float32>::epsilon();
294 template<>
inline bool areEqual(float64 a, float64 b)
296 return fabs(a - b) < std::numeric_limits<float64>::epsilon();
299 template<>
inline bool areEqual(complex64 a, complex64 b)
304 template<>
inline bool areEqual(complex128 a, complex128 b)
Definition apiFunctionsGraph.cpp:40
bool isNotZero(_Tp value)
method returns whether a given variable is not equal to zero.
Definition numeric.h:47
bool isInf< float32 >(float32 value)
Check if a value is infinite float32 values.
Definition numeric.h:204
bool isFinite< float32 >(float32 value)
Check if a value is finite float32 values.
Definition numeric.h:107
bool areEqual(_Tp a, _Tp b)
method returns whether two given numbers of the same type are equal.
Definition numeric.h:283
bool isNotZero< complex64 >(complex64 value)
Check if a value is equal to zero for complex64.
Definition numeric.h:71
bool isFinite(_Tp)
method returns whether a given variable is finite.
Definition numeric.h:101
bool isNaN< complex128 >(complex128 value)
Check if one of the components of complex128 values are not a number.
Definition numeric.h:179
bool isNaN< float64 >(float64 value)
Check if a value is isNaN float64 values.
Definition numeric.h:162
bool isNotZero< float64 >(float64 value)
Check if a value is equal to zero for float64.
Definition numeric.h:62
bool isInf< complex128 >(complex128 value)
Check if one of the components of complex128 values are infinite.
Definition numeric.h:228
bool isNaN< complex64 >(complex64 value)
Check if one of the components of complex64 values are not a number.
Definition numeric.h:169
bool isFinite< complex64 >(complex64 value)
Check if both components of complex64 value are finite.
Definition numeric.h:121
bool isNotZero< complex128 >(complex128 value)
Check if a value is equal to zero for complex128.
Definition numeric.h:81
bool isInf(_Tp)
method returns whether a given variable is Inf / not may be NaN.
Definition numeric.h:198
bool isFinite< float64 >(float64 value)
Check if a value is finite float64 values.
Definition numeric.h:114
bool isNaN< float32 >(float32 value)
Check if a value is isNaN float32 values.
Definition numeric.h:156
bool isZeroValue(_Tp v, _Tp)
method returns whether a given variable is equal to zero.
Definition numeric.h:248
bool isInf< float64 >(float64 value)
Check if a value is infinite float64 values.
Definition numeric.h:211
bool isNaN(_Tp value)
method returns whether a given variable is NaN / not a Number but maybe Inf.
Definition numeric.h:150
bool isNotZero< float32 >(float32 value)
Check if a value is equal to zero for float32.
Definition numeric.h:53
bool isFinite< complex128 >(complex128 value)
Check if both components of complex128 value are finite.
Definition numeric.h:131
bool isInf< complex64 >(complex64 value)
Check if one of the components of complex64 values are infinite.
Definition numeric.h:218