MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / isIntegral

Method isIntegral

Sources/Dependencies/jsoncpp/value.cpp:1528–1552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1526 }
1527
1528 bool Value::isIntegral() const {
1529 switch (type()) {
1530 case intValue:
1531 case uintValue:
1532 return true;
1533 case realValue:
1534#if defined(JSON_HAS_INT64)
1535 // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a
1536 // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we
1537 // require the value to be strictly less than the limit.
1538 // minInt64 is -2^63 which can be represented as a double, but since double
1539 // values in its proximity are also rounded to -2^63, we require the value
1540 // to be strictly greater than the limit to avoid returning 'true' for
1541 // values that are not in the range
1542 return value_.real_ > double(minInt64) &&
1543 value_.real_ < maxUInt64AsDouble && IsIntegral(value_.real_);
1544#else
1545 return value_.real_ >= minInt && value_.real_ <= maxUInt &&
1546 IsIntegral(value_.real_);
1547#endif // JSON_HAS_INT64
1548 default:
1549 break;
1550 }
1551 return false;
1552 }
1553
1554 bool Value::isDouble() const {
1555 return type() == intValue || type() == uintValue || type() == realValue;

Callers

nothing calls this directly

Calls 2

typeClass · 0.85
IsIntegralFunction · 0.85

Tested by

no test coverage detected