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())
81 template<
typename _Tp>
inline bool isFinite(_Tp )
89 unsigned char *ch = (
unsigned char *)&value;
90 return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0x80) != 0x80;
96 unsigned char *ch = (
unsigned char *)&value;
97 return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0;
103 float32 realVal = value.real();
104 float32 imagVal = value.real();
105 unsigned char *chreal = (
unsigned char *)&realVal;
106 unsigned char *chimag = (
unsigned char *)&imagVal;
107 return ((chreal[3] & 0x7f) != 0x7f || (chreal[2] & 0x80) != 0x80) && ((chimag[3] & 0x7f) != 0x7f || (chimag[2] & 0x80) != 0x80);
113 float64 realVal = value.real();
114 float64 imagVal = value.real();
115 unsigned char *chreal = (
unsigned char *)&realVal;
116 unsigned char *chimag = (
unsigned char *)&imagVal;
117 return ((chreal[7] & 0x7f) != 0x7f || (chreal[6] & 0xf0) != 0xf0) && ((chimag[7] & 0x7f) != 0x7f || (chimag[6] & 0xf0) != 0xf0);
130 template<
typename _Tp>
inline bool isNaN(_Tp value)
138 unsigned char *ch = (
unsigned char *)&value;
139 return (ch[3] & 0x7f) == 0x7f && ch[2] > 0x80;
144 unsigned char *ch = (
unsigned char *)&value;
145 return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0;
151 float32 realVal = value.real();
152 float32 imagVal = value.real();
153 unsigned char *chreal = (
unsigned char *)&realVal;
154 unsigned char *chimag = (
unsigned char *)&imagVal;
155 return ((chreal[3] & 0x7f) == 0x7f && chreal[2] > 0x80) || ((chimag[3] & 0x7f) == 0x7f && chimag[2] > 0x80);
161 float64 realVal = value.real();
162 float64 imagVal = value.real();
163 unsigned char *chreal = (
unsigned char *)&realVal;
164 unsigned char *chimag = (
unsigned char *)&imagVal;
165 return ((chreal[7] & 0x7f) == 0x7f && chreal[6] > 0xf0) || ((chimag[7] & 0x7f) == 0x7f && chimag[6] > 0xf0);
178 template<
typename _Tp>
inline bool isInf(_Tp )
186 unsigned char *ch = (
unsigned char *)&value;
187 return (ch[3] & 0x7f) == 0x7f && ch[2] == 0x80;
193 unsigned char *ch = (
unsigned char *)&value;
194 return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0;
200 float32 realVal = value.real();
201 float32 imagVal = value.real();
202 unsigned char *chreal = (
unsigned char *)&realVal;
203 unsigned char *chimag = (
unsigned char *)&imagVal;
204 return ((chreal[3] & 0x7f) == 0x7f && chreal[2] == 0x80) || ((chimag[3] & 0x7f) == 0x7f && chimag[2] == 0x80);
210 float64 realVal = value.real();
211 float64 imagVal = value.real();
212 unsigned char *chreal = (
unsigned char *)&realVal;
213 unsigned char *chimag = (
unsigned char *)&imagVal;
214 return ((chreal[7] & 0x7f) == 0x7f && chreal[6] == 0xf0) || ((chimag[7] & 0x7f) == 0x7f && chimag[6] == 0xf0);
233 template<>
inline bool isZeroValue(Rgba32 v, Rgba32 )
235 return v == Rgba32::zeros();
238 template<>
inline bool isZeroValue(float32 v, float32 epsilon)
240 return v >= epsilon ?
false : (v <= -epsilon ?
false :
true);
243 template<>
inline bool isZeroValue(float64 v, float64 epsilon)
245 return v >= epsilon ?
false : (v <= -epsilon ?
false :
true);
248 template<>
inline bool isZeroValue(std::complex<ito::float32> v, std::complex<ito::float32> epsilon)
250 return isZeroValue<ito::float32>(v.real(), epsilon.real()) && isZeroValue<ito::float32>(v.imag(), epsilon.real());
253 template<>
inline bool isZeroValue(std::complex<ito::float64> v, std::complex<ito::float64> epsilon)
255 return isZeroValue<ito::float64>(v.real(), epsilon.real()) && isZeroValue<ito::float64>(v.imag(), epsilon.real());
263 template<
typename _Tp>
inline bool areEqual(_Tp a, _Tp b)
269 template<>
inline bool areEqual(float32 a, float32 b)
271 return fabs(a - b) < std::numeric_limits<float32>::epsilon();
274 template<>
inline bool areEqual(float64 a, float64 b)
276 return fabs(a - b) < std::numeric_limits<float64>::epsilon();
279 template<>
inline bool areEqual(complex64 a, complex64 b)
281 return areEqual<ito::float32>(a.real(), b.real()) && areEqual<ito::float32>(a.imag(), b.imag());
284 template<>
inline bool areEqual(complex128 a, complex128 b)
286 return areEqual<ito::float64>(a.real(), b.real()) && areEqual<ito::float64>(a.imag(), b.imag());
bool isNotZero(_Tp value)
method returns whether a given variable is not equal to zero.
Definition: numeric.h:47
bool isInf< complex64 >(complex64 value)
Check if one of the components of complex64 values are infinite.
Definition: numeric.h:198
bool isNaN(_Tp value)
method returns whether a given variable is NaN / not a Number but maybe Inf.
Definition: numeric.h:130
bool isNotZero< float32 >(float32 value)
Check if a value is equal to zero for float32.
Definition: numeric.h:53
bool isFinite(_Tp)
method returns whether a given variable is finite.
Definition: numeric.h:81
bool isNotZero< float64 >(float64 value)
Check if a value is equal to zero for float64.
Definition: numeric.h:62
bool isInf(_Tp)
method returns whether a given variable is Inf / not may be NaN.
Definition: numeric.h:178
bool isNaN< float64 >(float64 value)
Check if a value is isNaN float64 values.
Definition: numeric.h:142
bool isInf< complex128 >(complex128 value)
Check if one of the components of complex128 values are infinite.
Definition: numeric.h:208
bool isFinite< complex128 >(complex128 value)
Check if both components of complex128 value are finite.
Definition: numeric.h:111
bool isZeroValue(_Tp v, _Tp)
method returns whether a given variable is equal to zero.
Definition: numeric.h:228
Definition: apiFunctionsGraph.cpp:39
bool isNaN< float32 >(float32 value)
Check if a value is isNaN float32 values.
Definition: numeric.h:136
bool isInf< float32 >(float32 value)
Check if a value is infinite float32 values.
Definition: numeric.h:184
bool isFinite< float32 >(float32 value)
Check if a value is finite float32 values.
Definition: numeric.h:87
bool isNaN< complex64 >(complex64 value)
Check if one of the components of complex64 values are not a number.
Definition: numeric.h:149
bool isInf< float64 >(float64 value)
Check if a value is infinite float64 values.
Definition: numeric.h:191
bool isNaN< complex128 >(complex128 value)
Check if one of the components of complex128 values are not a number.
Definition: numeric.h:159
bool isFinite< complex64 >(complex64 value)
Check if both components of complex64 value are finite.
Definition: numeric.h:101
bool isFinite< float64 >(float64 value)
Check if a value is finite float64 values.
Definition: numeric.h:94
bool areEqual(_Tp a, _Tp b)
method returns whether two given numbers of the same type are equal.
Definition: numeric.h:263