Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix incorrect formatting of probabilities in the sidebar
This resulted from an incorrect use of std::setprecision, which sets the number of significant figures to display, not the number of decimal places.
  • Loading branch information
CelticMinstrel committed Jul 4, 2018
1 parent b7790eb commit 021ce76
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/reports.cpp
Expand Up @@ -844,9 +844,11 @@ static std::string format_prob(double prob)
{
if(prob > 0.9995) {
return "100%";
} else if(prob < 0.0005) {
return "0%";
}
std::ostringstream res;
res << std::setprecision(1) << std::setw(4) << 100.0 * prob << "%";
res << std::setprecision(prob < 0.1 ? 2 : 3) << 100.0 * prob << "%";
return res.str();
}

Expand Down

0 comments on commit 021ce76

Please sign in to comment.