jubatus / jubatus_core

Jubatus algorithm component
GNU Lesser General Public License v2.1
20 stars 29 forks source link

clustering_util_test.util_test.dist fails in i686 #386

Closed kazuki closed 3 years ago

kazuki commented 7 years ago

I tested in python manylinux1 environment (CentOS5 i686 + gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15) and Ubuntu 14.04 (i686, gcc 4.8.4-2ubuntu1~14.04.3).

[ RUN      ] util_test.dist                                                                  
../jubatus/core/clustering/util_test.cpp:45: Failure
Value of: std::sqrt(2)                                                 
  Actual: 1.41421                           
Expected: dist(p1, p2)                                                                       
Which is: 1.41421

This is mysterious problem.

This patch is works fine.

diff --git a/jubatus/core/clustering/util_test.cpp b/jubatus/core/clustering/util_test.cpp
index 5ee2bd36..d88e0f27 100644
--- a/jubatus/core/clustering/util_test.cpp
+++ b/jubatus/core/clustering/util_test.cpp
@@ -37,8 +37,13 @@ TEST_F(util_test, dist) {
   p2.push_back(make_pair("x", 2));
   p2.push_back(make_pair("y", 2));

+  // workaround in i686 arch + gcc4.8
+  // EXPECT_EQ(dist(p1, p2), std::sqrt(2));
+  double t0 = dist(p1, p2);
+  double t1 = std::sqrt(2);
+  EXPECT_EQ(t0, t1);
   EXPECT_EQ(dist(p1, p1), 0);
-  EXPECT_EQ(dist(p1, p2), std::sqrt(2));
+  EXPECT_EQ(t0, t1);
 }

 }  // namespace clustering

But this patch is cannot fix this problem.

diff --git a/jubatus/core/clustering/util_test.cpp b/jubatus/core/clustering/util_test.cpp
index 5ee2bd36..5ba32540 100644
--- a/jubatus/core/clustering/util_test.cpp
+++ b/jubatus/core/clustering/util_test.cpp
@@ -37,8 +37,12 @@ TEST_F(util_test, dist) {
   p2.push_back(make_pair("x", 2));
   p2.push_back(make_pair("y", 2));

+  // workaround in i686 arch + gcc4.8
+  // EXPECT_EQ(dist(p1, p2), std::sqrt(2));
+  double t0 = dist(p1, p2);
+  double t1 = std::sqrt(2);
+  EXPECT_EQ(t0, t1);
   EXPECT_EQ(dist(p1, p1), 0);
-  EXPECT_EQ(dist(p1, p2), std::sqrt(2));
 }

 }  // namespace clustering
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

Closing this issue after a prolonged period of inactivity. Please feel free to create a new issue or re-open it if you need.