Fixed epsilon for half types

This commit is contained in:
Christophe Riccio
2012-11-06 02:26:31 +01:00
parent 1fb8bec873
commit bfec0e2388
4 changed files with 21 additions and 13 deletions

View File

@@ -2,6 +2,10 @@
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
///
/// This half implementation is based on OpenEXR which is Copyright (c) 2002,
/// Industrial Light & Magic, a division of Lucas Digital Ltd. LLC
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
@@ -24,10 +28,6 @@
/// @file glm/core/type_half.inl
/// @date 2008-08-17 / 2011-06-15
/// @author Christophe Riccio
///
/// Copyright:
/// This half implementation is based on OpenEXR which is Copyright (c) 2002,
/// Industrial Light & Magic, a division of Lucas Digital Ltd. LLC
///////////////////////////////////////////////////////////////////////////////////
#include "_detail.hpp"
@@ -152,7 +152,7 @@ namespace detail
// less than half_MIN (f may be a small normalized
// float, a denormalized float or a zero).
//
// We convert f to a _halfGTX zero.
// We convert f to a half zero.
//
return 0;
@@ -162,7 +162,7 @@ namespace detail
// E is between -10 and 0. F is a normalized float,
// whose magnitude is less than __half_NRM_MIN.
//
// We convert f to a denormalized _halfGTX.
// We convert f to a denormalized half.
//
m = (m | 0x00800000) >> (1 - e);
@@ -180,7 +180,7 @@ namespace detail
m += 0x00002000;
//
// Assemble the _halfGTX from s, e (zero) and m.
// Assemble the half from s, e (zero) and m.
//
return hdata(s | (m >> 13));

View File

@@ -34,6 +34,12 @@ namespace glm
return std::numeric_limits<T>::epsilon();
}
template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR half epsilon()
{
return half(1.19209290e-007);
}
template <typename T>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T zero()
{