Commit e61169e6 authored by Milo Yip's avatar Milo Yip

Fix Value::GetFloat()

parent 23e410b1
...@@ -1480,10 +1480,11 @@ public: ...@@ -1480,10 +1480,11 @@ public:
RAPIDJSON_ASSERT((flags_ & kUint64Flag) != 0); return static_cast<double>(data_.n.u64); // uint64_t -> double (may lose precision) RAPIDJSON_ASSERT((flags_ & kUint64Flag) != 0); return static_cast<double>(data_.n.u64); // uint64_t -> double (may lose precision)
} }
//! Get the value as double type. //! Get the value as float type.
/*! \note If the value is 64-bit integer type, it may lose precision. Use \c IsLosslessFloat() to check whether the converison is lossless. /*! \note If the value is 64-bit integer type, it may lose precision. Use \c IsLosslessFloat() to check whether the converison is lossless.
*/ */
double GetFloat() const { float GetFloat() const {
RAPIDJSON_ASSERT(IsFloat());
return static_cast<float>(GetDouble()); return static_cast<float>(GetDouble());
} }
......
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