- Micro Optimization

This commit is contained in:
2025-07-02 18:23:53 -04:00
parent 0eeb7ae3cf
commit 0afaae72ac

View File

@@ -461,12 +461,13 @@ constexpr genType roundEven(genType x)
//bool up = r - fennec::floor(r) > e;
//return i + static_cast<genType>(up);
static const genType e = std::numeric_limits<genType>::epsilon();
genType i = fennec::floor(x);
int I = static_cast<int>(x);
genType i = static_cast<genType>(I);
genType f = x - i;
if (abs(f - genType(0.5)) > e)
return fennec::round(x);
bool dir = (static_cast<int>(x) % 2);
bool dir = (I % 2);
return dir ? i + 1 : i;
}