From e61169e61a3bd365125cbe73cb224d5ed03cc168 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Fri, 12 Feb 2016 18:13:11 +0800 Subject: [PATCH] Fix Value::GetFloat() --- include/rapidjson/document.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index b0a5d34..5c77dbe 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -1480,10 +1480,11 @@ public: RAPIDJSON_ASSERT((flags_ & kUint64Flag) != 0); return static_cast(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. */ - double GetFloat() const { + float GetFloat() const { + RAPIDJSON_ASSERT(IsFloat()); return static_cast(GetDouble()); }