From 0a83e90e321226339653ac8181ad04dee4bca38e Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Thu, 28 Sep 2023 10:16:52 +0800 Subject: [PATCH] Fix bug of calling unintended function nearint --- src/include/client.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/include/client.h b/src/include/client.h index 7033d52..290503e 100644 --- a/src/include/client.h +++ b/src/include/client.h @@ -228,7 +228,7 @@ std::vector > GenerateEquations() { */ const double eps = 1e-6; const int error_status_of_nearint = -0x3f3f3f3f; -inline int nearint(double v) { +inline int NearbyInt(double v) { int raw = v + 0.5; if (abs(v - raw) < eps) return raw; @@ -277,15 +277,22 @@ void InterpretResult(std::vector > equations) { // std::cout << "equations[" << i << "]:" << std::endl; int number_of_1 = 0, number_of_non1 = 0, vid = -1; for (int j = 0; j < m - 1; j++) - if (nearbyint(equations[i][j]) == 1) { + if (NearbyInt(equations[i][j]) == 1) { number_of_1++; vid = j; - } else if (nearbyint(equations[i][j]) != 0) + } else if (NearbyInt(equations[i][j]) != 0) number_of_non1++; if (number_of_non1) continue; if (number_of_1 != 1) continue; - int sol = nearbyint(equations[i][m - 1]); + int sol = NearbyInt(equations[i][m - 1]); if (sol == error_status_of_nearint) continue; + if(sol!=0&&sol!=1) + { + std::cerr<<"sol="<