55TEST(SolutionBoundsTest, RelativePrecisionWithExtendedRationalNumbers) {
57 auto const rational = [](
int numerator,
int denominator) {
62 bounds.
lower = std::vector<ExtendedRationalNumber>{rational(10, 1), rational(-101, 10)};
63 bounds.
upper = std::vector<ExtendedRationalNumber>{rational(101, 10), rational(-10, 1)};
65 EXPECT_TRUE(bounds.
isWithinPrecision({rational(201, 20), rational(-201, 20)}, rational(1, 100),
true));
66 EXPECT_FALSE(bounds.
isWithinPrecision({rational(201, 20), rational(-201, 20)}, rational(1, 250),
true));
68 bounds.
upper = std::vector<ExtendedRationalNumber>{ExtendedRationalNumber::infinity(), rational(-10, 1)};
69 EXPECT_FALSE(bounds.
isWithinPrecision({rational(201, 20), rational(-201, 20)}, rational(1, 100),
true));
bool isWithinPrecision(std::vector< ValueType > const &values, ValueType const &precision, bool relative) const
Returns true if both bounds are set and neither is further from its value than the given precision al...