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.
This commit is contained in:
Celtic Minstrel 2018-07-03 22:16:03 -04:00 committed by GitHub
parent b7790eb93f
commit 021ce76dca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
}