Improve template & doc for PIMathFloatNullCompare

This commit is contained in:

View File

@@ -119,10 +119,10 @@ inline PIVector2D<double> abs(const PIVector2D<complexd> & v) {
/**
* @brief Inline funtion of compare with zero different types
* @brief floating point number specific comparison between value passed as parameter and zero
*
* @param v is input parameter of type T
* @return true if zero, false if not zero
* @param v floating point parameter for comparison
* @return true if v in locality of zero, otherwise false
*/
template<typename T, typename std::enable_if<std::is_floating_point<T>::value, int>::type = 0>
inline bool PIMathFloatNullCompare(const T v) {
@@ -131,15 +131,15 @@ inline bool PIMathFloatNullCompare(const T v) {
}
/**
* @brief Inline funtion of compare with zero colmplexf type
* @brief floating point number specific comparison between parameter value and zero.
*
* @param v is input parameter of type colmplexf
* @return true if zero, false if not zero
* @param v complex with floating point real and imag parts
* @return true if absolute of v in locality of zero, otherwise false
*/
template<typename T,typename std::enable_if<
std::is_floating_point<decltype(T::real)>::value ||
std::is_floating_point<decltype(T::imag)>::value
, int>::type = 0>
std::is_floating_point<decltype(T::real)>::value &&
std::is_floating_point<decltype(T::imag)>::value
, int>::type = 0>
inline bool PIMathFloatNullCompare(const T v) {
static_assert(std::is_floating_point<decltype(v.real)>::value, "Type must be floating point");
static_assert(std::is_floating_point<decltype(v.imag)>::value, "Type must be floating point");