avoid using hard-code precision when writing double to streams
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user