From 2f8f798d1685ddbf16c43915b0ff3c72a95f7968 Mon Sep 17 00:00:00 2001 From: Ingmar Schoegl Date: Tue, 20 Jun 2023 08:56:47 -0600 Subject: [PATCH] [base] Increase precision for CSV output --- src/base/SolutionArray.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/base/SolutionArray.cpp b/src/base/SolutionArray.cpp index 871c31085f..7d1afceeff 100644 --- a/src/base/SolutionArray.cpp +++ b/src/base/SolutionArray.cpp @@ -1048,7 +1048,8 @@ void SolutionArray::writeEntry(const string& fname, bool overwrite, const string std::remove(fname.c_str()); } std::ofstream output(fname); - output << header.str() << std::endl; + const auto default_precision = output.precision(); + output << header.str() << std::endl << std::setprecision(9); vector buf(speciesNames.size(), 0.); for (size_t row = 0; row < m_size; row++) { @@ -1092,7 +1093,7 @@ void SolutionArray::writeEntry(const string& fname, bool overwrite, const string } output << std::endl; } - output << std::endl; + output << std::endl << std::setprecision(default_precision); if (escaped) { warn_user("SolutionArray::writeEntry",