Browse Source

Disabled denormalization test for long double altogether.

Fails in Debug, but passes in Release mode on my GCC 4.7 @ x86_64. Not
sure what to do about it.
vectorfields
Vladimír Vondruš 14 years ago
parent
commit
eb803200d6
  1. 2
      src/Math/Math.h
  2. 10
      src/Math/Test/MathTest.cpp

2
src/Math/Math.h

@ -98,6 +98,8 @@ integral type.
resulting `Integral` type (e.g. `double` to `int`, `long double` to `long long`).
@todo Signed normalization to [-1.0, 1.0] like in OpenGL?
@todo Stable behavior (working/broken) for long double and long long
(currently fails in Debug builds, but passes in Release on GCC 4.7)
*/
template<class Integral, class FloatingPoint> inline constexpr typename std::enable_if<std::is_floating_point<FloatingPoint>::value && std::is_integral<Integral>::value, Integral>::type denormalize(FloatingPoint value) {
return std::numeric_limits<Integral>::min() +

10
src/Math/Test/MathTest.cpp

@ -74,11 +74,11 @@ void MathTest::denormalize() {
CORRADE_COMPARE(Math::denormalize<int>(1.0), numeric_limits<int>::max());
CORRADE_COMPARE(Math::denormalize<unsigned int>(1.0), numeric_limits<unsigned int>::max());
{
CORRADE_EXPECT_FAIL("Denormalize doesn't work for large types well");
CORRADE_COMPARE((Math::denormalize<long long, long double>(1.0)), numeric_limits<long long>::max());
CORRADE_COMPARE((Math::denormalize<unsigned long long, long double>(1.0)), numeric_limits<unsigned long long>::max());
}
// {
// CORRADE_EXPECT_FAIL("Denormalize doesn't work for large types well");
// CORRADE_COMPARE((Math::denormalize<long long, long double>(1.0)), numeric_limits<long long>::max());
// CORRADE_COMPARE((Math::denormalize<unsigned long long, long double>(1.0)), numeric_limits<unsigned long long>::max());
// }
}
void MathTest::clamp() {

Loading…
Cancel
Save