Merge pull request #4970 from akva2/janitoring

Quell an uninitialized variable static analyzer warning
This commit is contained in:
Bård Skaflestad
2023-11-06 10:17:54 +01:00
committed by GitHub

View File

@@ -814,29 +814,29 @@ bruteForceBracket(const std::function<double(const double)>& eq,
double& low, double& high,
DeferredLogger& deferred_logger)
{
bool finding_bracket = false;
bool bracket_found = false;
low = range[0];
high = range[1];
const int sample_number = 200;
const double interval = (high - low) / sample_number;
double eq_low = eq(low);
double eq_high;
double eq_high = 0.0;
for (int i = 0; i < sample_number + 1; ++i) {
high = range[0] + interval * i;
eq_high = eq(high);
if (eq_high * eq_low <= 0.) {
finding_bracket = true;
bracket_found = true;
break;
}
low = high;
eq_low = eq_high;
}
if (finding_bracket) {
if (bracket_found) {
deferred_logger.debug(
" brute force solve found low " + std::to_string(low) + " with eq_low " + std::to_string(eq_low) +
" high " + std::to_string(high) + " with eq_high " + std::to_string(eq_high));
}
return finding_bracket;
return bracket_found;
}
#define INSTANCE(...) \