Always used fixed precision for formatting size strings (#3871)
As recommended.
This commit is contained in:
parent
548e8584b8
commit
9b436ef743
1 changed files with 0 additions and 11 deletions
|
@ -524,20 +524,9 @@ std::string half_signed_value(int val)
|
|||
|
||||
static void si_string_impl_stream_write(std::stringstream &ss, double input) {
|
||||
std::streamsize oldprec = ss.precision();
|
||||
#ifdef _MSC_VER
|
||||
// Visual C++ makes 'precision' set the number of decimal places.
|
||||
// Other platforms make it set the number of significant figures
|
||||
ss.precision(1);
|
||||
ss << std::fixed
|
||||
<< input;
|
||||
#else
|
||||
// Workaround to display 1023 KiB instead of 1.02e3 KiB
|
||||
if (input >= 1000)
|
||||
ss.precision(4);
|
||||
else
|
||||
ss.precision(3);
|
||||
ss << input;
|
||||
#endif
|
||||
ss.precision(oldprec);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue