Commit 3116cb54 authored by Nabil Chouika's avatar Nabil Chouika
Browse files

refs#16

In ElementaryUtils (trunk):
- Better implementation of the precision in Formatter and GenericType.
parent 5a40dc3b
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
* @version 1.0 * @version 1.0
*/ */
#include <stddef.h>
#include <iomanip> #include <iomanip>
#include <limits>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <cstddef>
namespace ElemUtils { namespace ElemUtils {
...@@ -30,7 +31,7 @@ public: ...@@ -30,7 +31,7 @@ public:
*/ */
template<class T> template<class T>
GenericType(const T &value) { GenericType(const T &value) {
m_stream << std::setprecision(16) << value; m_stream << std::setprecision(std::numeric_limits<double>::digits10) << value;
} }
/** /**
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <limits>
namespace ElemUtils { namespace ElemUtils {
...@@ -23,7 +24,7 @@ class Formatter { ...@@ -23,7 +24,7 @@ class Formatter {
public: public:
Formatter() { Formatter() {
// use to print full precision double // use to print full precision double
m_stream << std::setprecision(16); m_stream << std::setprecision(std::numeric_limits<double>::digits10);
} }
~Formatter() { ~Formatter() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment