From 0f8b75cb93bbc9349ce5aff330f535cc70ddce8c Mon Sep 17 00:00:00 2001 From: Guolin Ke Date: Thu, 26 Oct 2017 11:43:19 +0800 Subject: [PATCH] fix a bug --- include/LightGBM/utils/common.h | 2 +- src/io/bin.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/LightGBM/utils/common.h b/include/LightGBM/utils/common.h index a3f1dc28a355..8a1bb84c70d9 100644 --- a/include/LightGBM/utils/common.h +++ b/include/LightGBM/utils/common.h @@ -648,7 +648,7 @@ inline bool FindInBitset(const uint32_t* bits, int n, T pos) { inline static bool CheckDoubleEqual(double a, double b) { double lower = std::nextafter(a, -INFINITY); - double upper = std::nextafter(b, INFINITY); + double upper = std::nextafter(a, INFINITY); return b >= lower && b <= upper; } diff --git a/src/io/bin.cpp b/src/io/bin.cpp index a89b4969da91..e16ea6f04574 100644 --- a/src/io/bin.cpp +++ b/src/io/bin.cpp @@ -241,7 +241,7 @@ namespace LightGBM { } for (int i = 1; i < num_sample_values; ++i) { - if (Common::CheckDoubleEqual(values[i - 1], values[i])) { + if (!Common::CheckDoubleEqual(values[i - 1], values[i])) { if (values[i - 1] < 0.0f && values[i] > 0.0f) { distinct_values.push_back(0.0f); counts.push_back(zero_cnt);