Skip to content

Commit 49addc1

Browse files
author
cmlchen
committed
extract variable
1 parent 1f16fc4 commit 49addc1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lib_json/json_value.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,11 @@ bool Value::asBool() const {
847847
return value_.int_ ? true : false;
848848
case uintValue:
849849
return value_.uint_ ? true : false;
850-
case realValue:
851-
// According to JavaScript language zero or NaN is regarded as false
852-
return std::fpclassify(value_.real_) != FP_ZERO && std::fpclassify(value_.real_) != FP_NAN;
850+
case realValue: {
851+
// According to JavaScript language zero or NaN is regarded as false
852+
const auto value_classification = std::fpclassify(value_.real_);
853+
return value_classification != FP_ZERO && value_classification != FP_NAN;
854+
}
853855
default:
854856
break;
855857
}

0 commit comments

Comments
 (0)