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.
(cherry-picked from commit 41e757be9f
)
This commit is contained in:
parent
a930dc28a9
commit
494ba287ec
1 changed files with 3 additions and 1 deletions
|
@ -843,9 +843,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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue