| 1640 | } |
| 1641 | |
| 1642 | bool CheckDoubleMultipleOf(Context& context, double d) const { |
| 1643 | double a = std::abs(d), b = std::abs(multipleOf_.GetDouble()); |
| 1644 | double q = a / b; |
| 1645 | double qRounded = std::floor(q + 0.5); |
| 1646 | double scaledEpsilon = (q + qRounded) * std::numeric_limits<double>::epsilon(); |
| 1647 | double difference = std::abs(qRounded - q); |
| 1648 | bool isMultiple = difference <= scaledEpsilon || difference < (std::numeric_limits<double>::min)(); |
| 1649 | if (!isMultiple) { |
| 1650 | context.error_handler.NotMultipleOf(d, multipleOf_); |
| 1651 | RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorMultipleOf); |
| 1652 | } |
| 1653 | return true; |
| 1654 | } |
| 1655 | |
| 1656 | void DisallowedType(Context& context, const ValueType& actualType) const { |
| 1657 | ErrorHandler& eh = context.error_handler; |
nothing calls this directly
no test coverage detected