瀏覽代碼

Fixed error: comparing floating point with == or != is unsafe

Groove 7 年之前
父節點
當前提交
291287e45d
共有 1 個文件被更改,包括 2 次插入5 次删除
  1. 2 5
      test/core/core_type_mat4x3.cpp

+ 2 - 5
test/core/core_type_mat4x3.cpp

@@ -49,11 +49,8 @@ int test_ctr()
 		{6, 7, 8},
 		{9, 10, 11}};
 
-	for(glm::length_t i = 0; i < m0.length(); ++i)
-		Error += glm::all(glm::equal(m0[i], m2[i])) ? 0 : 1;
-
-	for(glm::length_t i = 0; i < m1.length(); ++i)
-		Error += glm::all(glm::equal(m1[i], m2[i])) ? 0 : 1;
+	Error += glm::all(glm::equal(m0, m2, glm::epsilon<float>())) ? 0 : 1;
+	Error += glm::all(glm::equal(m1, m2, glm::epsilon<float>())) ? 0 : 1;
 
 	std::vector<glm::mat4x3> v1{
 		{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},