#include <iomanip>
#include <iostream>
#include <sstream>
int main(int argc, char **argv)
{
std::stringstream ss;
double x = -1.890123;
//insert x into the stream twice with different precisions each time
ss << std::setprecision(2) << x << std::endl
<< std::setprecision(8) << x << std::endl;
//insert the std::string representation of ss into std::cout
std::cout << ss.str();
return 0;
}
I2luY2x1ZGUgPGlvbWFuaXA+CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHNzdHJlYW0+CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKICAgIHN0ZDo6c3RyaW5nc3RyZWFtIHNzOwogICAgZG91YmxlIHggPSAtMS44OTAxMjM7CiAgICAKICAgIC8vaW5zZXJ0IHggaW50byB0aGUgc3RyZWFtIHR3aWNlIHdpdGggZGlmZmVyZW50IHByZWNpc2lvbnMgZWFjaCB0aW1lCiAgICBzcyA8PCBzdGQ6OnNldHByZWNpc2lvbigyKSA8PCB4IDw8IHN0ZDo6ZW5kbAogICAgICAgPDwgc3RkOjpzZXRwcmVjaXNpb24oOCkgPDwgeCA8PCBzdGQ6OmVuZGw7CiAgICAKICAgIC8vaW5zZXJ0IHRoZSBzdGQ6OnN0cmluZyByZXByZXNlbnRhdGlvbiBvZiBzcyBpbnRvIHN0ZDo6Y291dAogICAgc3RkOjpjb3V0IDw8IHNzLnN0cigpOwogICAgCiAgICByZXR1cm4gMDsKfQ==