Skip to content

Instantly share code, notes, and snippets.

@blippy
Last active August 16, 2018 20:25
Show Gist options
  • Save blippy/4f721504c717a6614bf6a537e5197c7e to your computer and use it in GitHub Desktop.
Save blippy/4f721504c717a6614bf6a537e5197c7e to your computer and use it in GitHub Desktop.
Format a double for output
std::string dout(double d)
{
std::ostringstream s;
s.precision(2);
s.width(10);
s << std::fixed;
s << d;
return s.str();
}
@blippy
Copy link
Author

blippy commented Aug 16, 2018

#include <sstream>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment