maths: add samesign convenience function

This commit is contained in:
Danny Robson 2016-02-03 13:56:40 +11:00
parent e85ffe5160
commit 8022d459e5

View File

@ -292,6 +292,15 @@ namespace util {
return std::signbit (t) ? -1 : 1;
}
//-------------------------------------------------------------------------
template <typename T>
constexpr
bool
samesign (T a, T b)
{
return a < 0 && b < 0 || a > 0 && b > 0;
}
///////////////////////////////////////////////////////////////////////////////
// factorisation