set the precision to avoid(limit) round/loss of precision on 'float' numbers.
*/
#include <string>
#include <sstream>
+#include <iomanip>
+#include <cfloat>
/**
* Class to hold an actual reading value.
@@ -113,13 +115,16 @@ class DatapointValue {
std::string toString() const
{
std::ostringstream ss;
+
switch (m_type)
{
case T_INTEGER:
ss << m_value.i;
return ss.str();
case T_FLOAT:
+ ss << std::setprecision(DBL_DIG);
ss << m_value.f;
+
return ss.str();
case T_STRING:
default:
