Serialization: using maximum precision when converting double to string.
This commit is contained in:
parent
79c7a263a3
commit
ad89e280f9
2 changed files with 3 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
# include <string>
|
||||
# include <sstream>
|
||||
# include <limits>
|
||||
|
||||
# include "Entity.h"
|
||||
|
||||
|
|
@ -60,6 +61,7 @@ template<class T>
|
|||
inline void String::deserialize( T & value )
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss.precision(std::numeric_limits<double>::digits10 + 1);
|
||||
ss << *this;
|
||||
ss >> value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ namespace eoserial
|
|||
String* make( const T & value )
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss.precision(std::numeric_limits<double>::digits10 + 1);
|
||||
ss << value;
|
||||
return new String( ss.str() );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue