00001 // RealValue.cpp 00002 00003 #include <sstream> 00004 00005 #include "RealValue.h" 00006 00007 using namespace Yosokumo; 00008 00009 00010 RealValue::RealValue(double value) : Value(REAL, value) 00011 {} 00012 00013 double RealValue::getValue() const 00014 { 00015 return double_value; 00016 } 00017 00018 std::string RealValue::toString() const 00019 { 00020 // See p570 of Standard C++ IOStreams and Locales: It looks like by 00021 // setting the precision to 17 the conversion from double to string 00022 // uses %0.17g as the format, which is what we want (or should it be 16?) 00023 std::stringstream s; 00024 s.precision(17); 00025 s << double_value; 00026 return s.str(); 00027 } 00028 00029 // end RealValue.cpp