Skip to content

Commit

Permalink
Always used fixed precision for formatting size strings (#3871)
Browse files Browse the repository at this point in the history
As recommended.
  • Loading branch information
Vultraz committed Jan 22, 2019
1 parent 548e858 commit 9b436ef
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/serialization/string_utils.cpp
Expand Up @@ -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);
}

Expand Down

0 comments on commit 9b436ef

Please sign in to comment.