From c51d718ead5b8320dab84d15d5b57d887a7bc81a Mon Sep 17 00:00:00 2001 From: cmlchen Date: Tue, 25 Jun 2019 11:26:29 +0800 Subject: [PATCH] extract variable --- src/lib_json/json_value.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index b6f41de..508f18f 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -852,9 +852,11 @@ bool Value::asBool() const { return value_.int_ ? true : false; case uintValue: return value_.uint_ ? true : false; - case realValue: - // According to JavaScript language zero or NaN is regarded as false - return std::fpclassify(value_.real_) != FP_ZERO && std::fpclassify(value_.real_) != FP_NAN; + case realValue: { + // According to JavaScript language zero or NaN is regarded as false + const auto value_classification = std::fpclassify(value_.real_); + return value_classification != FP_ZERO && value_classification != FP_NAN; + } default: break; }