diff --git a/include/fennec/math/common.h b/include/fennec/math/common.h index f2a99d6..19c4ef9 100644 --- a/include/fennec/math/common.h +++ b/include/fennec/math/common.h @@ -461,12 +461,13 @@ constexpr genType roundEven(genType x) //bool up = r - fennec::floor(r) > e; //return i + static_cast(up); static const genType e = std::numeric_limits::epsilon(); - genType i = fennec::floor(x); + int I = static_cast(x); + genType i = static_cast(I); genType f = x - i; if (abs(f - genType(0.5)) > e) return fennec::round(x); - bool dir = (static_cast(x) % 2); + bool dir = (I % 2); return dir ? i + 1 : i; }