Unverified Commit eb027e1b authored by Alberto Ferreira's avatar Alberto Ferreira Committed by GitHub
Browse files

[fix] Fix IsZero in tree.h (#2932)


Co-authored-by: default avatarAlberto Ferreira <alberto.ferreira@feedzai.com>
parent 8d43356a
...@@ -196,19 +196,11 @@ class Tree { ...@@ -196,19 +196,11 @@ class Tree {
std::string ToIfElse(int index, bool predict_leaf_index) const; std::string ToIfElse(int index, bool predict_leaf_index) const;
inline static bool IsZero(double fval) { inline static bool IsZero(double fval) {
if (fval > -kZeroThreshold && fval <= kZeroThreshold) { return (fval >= -kZeroThreshold && fval <= kZeroThreshold);
return true;
} else {
return false;
}
} }
inline static double MaybeRoundToZero(double fval) { inline static double MaybeRoundToZero(double fval) {
if (fval > -kZeroThreshold && fval <= kZeroThreshold) { return IsZero(fval) ? 0 : fval;
return 0;
} else {
return fval;
}
} }
inline static bool GetDecisionType(int8_t decision_type, int8_t mask) { inline static bool GetDecisionType(int8_t decision_type, int8_t mask) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment