Merge pull request #1920 from Capostrophic/notation

Actually fix General (%g) number formatting (bug #4463)
pull/1822/head
Bret Curtis 6 years ago committed by GitHub
commit 29ea72ed6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -65,23 +65,18 @@ namespace Interpreter
} }
else if (notation == ShortestNotation) else if (notation == ShortestNotation)
{ {
std::string scientific; out << value;
std::string fixed; std::string standard = out.str();
out << std::scientific << value;
scientific = out.str();
out.str(std::string()); out.str(std::string());
out.clear(); out.clear();
out << std::fixed << value; out << std::scientific << value;
std::string scientific = out.str();
fixed = out.str();
mFormattedMessage += fixed.length() < scientific.length() ? fixed : scientific; mFormattedMessage += standard.length() < scientific.length() ? standard : scientific;
} }
else else
{ {
out << std::scientific << value; out << std::scientific << value;
mFormattedMessage += out.str(); mFormattedMessage += out.str();

Loading…
Cancel
Save