Browse Source

Fixed ldexp and frexp implementations

Christophe Riccio 12 years ago
parent
commit
aa0b2a5e28
2 changed files with 26 additions and 7 deletions
  1. 24 6
      glm/core/func_common.inl
  2. 2 1
      readme.txt

+ 24 - 6
glm/core/func_common.inl

@@ -1077,7 +1077,9 @@ namespace detail
 			std::numeric_limits<genType>::is_iec559,
 			"'frexp' only accept floating-point inputs");
 
-		return std::frexp(x, exp);
+		return detail::tvec2<T, P>(
+			frexp(x.x, exp.x),
+			frexp(x.y, exp.y));
 	}
 
 	template <typename T, precision P>
@@ -1091,7 +1093,10 @@ namespace detail
 			std::numeric_limits<genType>::is_iec559,
 			"'frexp' only accept floating-point inputs");
 
-		return std::frexp(x, exp);
+		return detail::tvec3<T, P>(
+			frexp(x.x, exp.x),
+			frexp(x.y, exp.y),
+			frexp(x.z, exp.z));
 	}
 
 	template <typename T, precision P>
@@ -1105,7 +1110,11 @@ namespace detail
 			std::numeric_limits<genType>::is_iec559,
 			"'frexp' only accept floating-point inputs");
 
-		return std::frexp(x, exp);
+		return detail::tvec4<T, P>(
+			frexp(x.x, exp.x),
+			frexp(x.y, exp.y),
+			frexp(x.z, exp.z),
+			frexp(x.w, exp.w));
 	}
 
 	template <typename genType, precision P>
@@ -1133,7 +1142,9 @@ namespace detail
 			std::numeric_limits<T>::is_iec559,
 			"'ldexp' only accept floating-point inputs");
 
-		return std::ldexp(x, exp);
+		return detail::tvec2<T, P>(
+			ldexp(x.x, exp.x),
+			ldexp(x.y, exp.y));
 	}
 
 	template <typename T, precision P>
@@ -1147,7 +1158,10 @@ namespace detail
 			std::numeric_limits<T>::is_iec559,
 			"'ldexp' only accept floating-point inputs");
 
-		return std::ldexp(x, exp);
+		return detail::tvec3<T, P>(
+			ldexp(x.x, exp.x),
+			ldexp(x.y, exp.y),
+			ldexp(x.z, exp.z));
 	}
 
 	template <typename T, precision P>
@@ -1161,7 +1175,11 @@ namespace detail
 			std::numeric_limits<T>::is_iec559,
 			"'ldexp' only accept floating-point inputs");
 
-		return std::ldexp(x, exp);
+		return detail::tvec4<T, P>(
+			ldexp(x.x, exp.x),
+			ldexp(x.y, exp.y),
+			ldexp(x.z, exp.z),
+			ldexp(x.w, exp.w));
 	}
 
 }//namespace glm

+ 2 - 1
readme.txt

@@ -59,11 +59,12 @@ GLM 0.9.5.0: 2013-XX-XX
 - Optimized packing and unpacking functions
 - Removed the normalization of the up argument of lookAt function (#114)
 - Added low precision specializations of inversesqrt
-- Fixed ldexp implementation
+- Fixed ldexp and frexp implementations
 - Increased assert coverage
 - Increased static_assert coverage
 - Replaced GLM traits by STL traits when possible
 - Allowed including individual core feature
+- Increased unit tests completness
 
 ================================================================================
 GLM 0.9.4.6: 2013-09-15