double const logarithm = log10(x);
os << std::setprecision(max(6 - static_cast<int>(round(logarithm)), 0)) << x;
string result = os.str();
double const logarithm = log10(x);
os << std::setprecision(max(6 - static_cast<int>(round(logarithm)), 0)) << x;
string result = os.str();