MCPcopy Create free account
hub / github.com/Illumina/hap.py / asDouble

Method asDouble

external/jsoncpp/jsoncpp.cpp:2231–2251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2229}
2230
2231double Value::asDouble() const {
2232 switch (type_) {
2233 case intValue:
2234 return static_cast<double>(value_.int_);
2235 case uintValue:
2236#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2237 return static_cast<double>(value_.uint_);
2238#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2239 return integerToDouble(value_.uint_);
2240#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2241 case realValue:
2242 return value_.real_;
2243 case nullValue:
2244 return 0.0;
2245 case booleanValue:
2246 return value_.bool_ ? 1.0 : 0.0;
2247 default:
2248 break;
2249 }
2250 JSON_FAIL_MESSAGE("Value is not convertible to double.");
2251}
2252
2253float Value::asFloat() const {
2254 switch (type_) {

Callers 1

writeValueMethod · 0.80

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected