From 5b911d1eb02b38bc79272532a05ad493c8c34962 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 19 Nov 2014 01:12:24 +0100 Subject: [PATCH 1/3] Fixed float comparison warnings #270 --- glm/gtc/matrix_transform.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index fa8d3e34..a18d823f 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -213,8 +213,8 @@ namespace glm T zFar ) { - assert(aspect != static_cast(0)); - assert(zFar != zNear); + assert(abs(aspect - std::numeric_limits::epsilon()) > static_cast(0)); + assert(zFar > zNear); T const tanHalfFovy = tan(fovy / static_cast(2)); From c07b3b2acfc1c5decf39d3d7cc3aae86ef428c36 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 19 Nov 2014 01:14:17 +0100 Subject: [PATCH 2/3] Fixed float comparison warnings #270 --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index e6bd5ba8..fac64573 100644 --- a/readme.txt +++ b/readme.txt @@ -84,6 +84,7 @@ Fixes: - Fixed implicit conversion from another tvec2 type to another tvec2 #241 - Fixed lack of consistency of quat and dualquat constructors - Fixed uaddCarray #253 +- Fixed float comparison warnings #270 Deprecation: - Removed degrees for function parameters From 7def3377811e68753820fb59be426f11c09f9922 Mon Sep 17 00:00:00 2001 From: plasmacel Date: Thu, 20 Nov 2014 15:33:28 +0100 Subject: [PATCH 3/3] Update func_common.inl --- glm/detail/func_common.inl | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 1a00ff50..9c55c7a1 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -151,22 +151,15 @@ namespace detail } // sign - //Try something like based on x >> 31 to get the sign bit + // fast and works for any type template GLM_FUNC_QUALIFIER genFIType sign(genFIType x) { GLM_STATIC_ASSERT( std::numeric_limits::is_iec559 || (std::numeric_limits::is_signed && std::numeric_limits::is_integer), "'sign' only accept signed inputs"); - - genFIType result; - if(x > genFIType(0)) - result = genFIType(1); - else if(x < genFIType(0)) - result = genFIType(-1); - else - result = genFIType(0); - return result; + + return genFIType(genFIType(0) < x) - (x < genFIType(0)); } template class vecType>