avoid using hard-code precision when writing double to streams

This commit is contained in:
wmayer
2019-02-23 14:58:41 +01:00
parent 183cd16263
commit bd89326d06
2 changed files with 6 additions and 2 deletions

View File

@@ -37,6 +37,7 @@
#include <algorithm>
#include <locale>
#include <limits>
using namespace Base;
using namespace std;
@@ -248,7 +249,7 @@ ZipWriter::ZipWriter(const char* FileName)
//FIXME: Check whether this is correct
ZipStream.imbue(std::locale::classic());
#endif
ZipStream.precision(16);
ZipStream.precision(std::numeric_limits<double>::digits10 + 1);
ZipStream.setf(ios::fixed,ios::floatfield);
}
@@ -261,7 +262,7 @@ ZipWriter::ZipWriter(std::ostream& os)
//FIXME: Check whether this is correct
ZipStream.imbue(std::locale::classic());
#endif
ZipStream.precision(16);
ZipStream.precision(std::numeric_limits<double>::digits10 + 1);
ZipStream.setf(ios::fixed,ios::floatfield);
}