MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / CheckDoubleMultipleOf

Method CheckDoubleMultipleOf

Source/ThirdParty/rapidjson/schema.h:1642–1654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 3

floorFunction · 0.85
NotMultipleOfMethod · 0.80
absFunction · 0.50

Tested by

no test coverage detected