mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 01:43:33 +08:00
Dependency on math.h and the last 'using namespace std' were removed
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user