@ -59,12 +59,34 @@ namespace Interpreter
mRuntime.pop();
if (notation == FixedNotation)
{
out << std::fixed << value;
else
mFormattedMessage += out.str();
}
else if (notation == ShortestNotation)
std::string scientific;
std::string fixed;
out << std::scientific << value;
scientific = out.str();
out.str(std::string());
out.clear();
fixed = out.str();
mFormattedMessage += fixed.length() < scientific.length() ? fixed : scientific;
break;
default:
@ -56,6 +56,8 @@ namespace Misc
visitedPlaceholder(FloatPlaceholder, pad, width, precision, FixedNotation);
else if (m[i] == 'e' || m[i] == 'E')
visitedPlaceholder(FloatPlaceholder, pad, width, precision, ScientificNotation);
else if (m[i] == 'g' || m[i] == 'G')
visitedPlaceholder(FloatPlaceholder, pad, width, precision, ShortestNotation);
@ -18,7 +18,8 @@ namespace Misc
enum Notation
FixedNotation,
ScientificNotation
ScientificNotation,
ShortestNotation
};
virtual void visitedPlaceholder(Placeholder placeholder, char padding, int width, int precision, Notation notation) = 0;