Dependency on math.h and the last 'using namespace std' were removed

This commit is contained in:
Pavel Kirienko
2015-03-21 14:14:48 +03:00
parent ec9006381b
commit 71d4b02a7f
2 changed files with 17 additions and 7 deletions
@@ -470,6 +470,20 @@ inline bool isInfinity(T arg)
#endif
}
/**
* Replacement for std::isfinite().
* Note that direct float comparison (==, !=) is intentionally avoided.
*/
template <typename T>
inline bool isFinite(T arg)
{
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
return std::isfinite(arg);
#else
return !isNaN(arg) && !isInfinity(arg);
#endif
}
/**
* Replacement for std::signbit().
* Note that direct float comparison (==, !=) is intentionally avoided.