Added uround to GTC_integer, fast round on positive values

This commit is contained in:
Christophe Riccio
2016-03-10 21:17:46 +01:00
parent f48fe286ad
commit c853df1638
5 changed files with 52 additions and 1 deletions

View File

@@ -210,11 +210,30 @@ namespace log2_
}
}//namespace log2_
namespace uround
{
int test()
{
int Error = 0;
for(float f = 0.0f; f < 3.1f; f += 0.05f)
{
int RoundFast = glm::uround(f);
int RoundSTD = std::round(f);
Error += RoundFast == RoundSTD ? 0 : 1;
assert(!Error);
}
return Error;
}
}//namespace uround
int main()
{
int Error(0);
Error += ::log2_::test();
Error += ::uround::test();
# ifdef NDEBUG
std::size_t const Samples(1000);