| 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; |
nothing calls this directly
no test coverage detected