Skip to content

Instantly share code, notes, and snippets.

View xarthurx's full-sized avatar
💭
“Premature optimization is the root of all evil.”

ZhaoMA xarthurx

💭
“Premature optimization is the root of all evil.”
View GitHub Profile
@xarthurx
xarthurx / precision.cpp
Last active March 14, 2023 17:23
cpp black magic #cpp
// Output precision of double
std::ostringstream oss;
oss.flags (std::ios::scientific);
oss.precision (std::numeric_limits<double>::digits10 + 1);
// double precision for writing files
myfile << std::setprecision(std::numeric_limits<double>::digits10 + 2) << number