Browse Source

Fixed round function

Christophe Riccio 14 years ago
parent
commit
91b8ae9c6e
1 changed files with 3 additions and 1 deletions
  1. 3 1
      glm/core/func_common.inl

+ 3 - 1
glm/core/func_common.inl

@@ -225,7 +225,9 @@ namespace glm
     {
     {
 		GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'round' only accept floating-point inputs");
 		GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'round' only accept floating-point inputs");
 
 
-        return genType(int(x + genType(0.5)));
+		if(x < 0)
+			return genType(int(x - genType(0.5)));
+		return genType(int(x + genType(0.5)));
     }
     }
 
 
     template <typename valType>
     template <typename valType>