diff --git a/shared/libebm/Purify.cpp b/shared/libebm/Purify.cpp index f51902604..85ab5b89b 100644 --- a/shared/libebm/Purify.cpp +++ b/shared/libebm/Purify.cpp @@ -374,8 +374,7 @@ extern ErrorEbm PurifyInternal(const double tolerance, const double* pWeightRetry = aWeights; do { const double weight = *pWeightRetry; - EBM_ASSERT(!std::isnan(weight) && (0.0 == weight || std::numeric_limits::min() <= weight) && - weight != std::numeric_limits::infinity()); + EBM_ASSERT(!std::isnan(weight) && 0.0 <= weight && weight != std::numeric_limits::infinity()); const double score = *IndexByte(pScores, iScoreRetry); if(!std::isnan(score) && !std::isinf(score)) { double weightTimesFactor = factorPre * weight; @@ -1014,12 +1013,14 @@ extern ErrorEbm PurifyInternal(const double tolerance, } double newIntercept = *pIntercept; - if(-std::numeric_limits::min() < newIntercept && - newIntercept < std::numeric_limits::min()) { - // eliminate denormals - newIntercept = 0.0; - } + EBM_ASSERT(!std::isnan(newIntercept)); // we never write NaN + EBM_ASSERT(!std::isinf(newIntercept)); // we never write inf + + // *pIntercept started off as zero and we haven't written a denormal + EBM_ASSERT(0.0 == newIntercept || newIntercept <= -std::numeric_limits::min() || + std::numeric_limits::min() <= newIntercept); newIntercept += interceptChange; + EBM_ASSERT(!std::isnan(newIntercept)); if(-std::numeric_limits::min() < newIntercept && newIntercept < std::numeric_limits::min()) { // eliminate denormals