Skip to content

Commit 33c22be

Browse files
lperronMizux
authored andcommitted
inprove code
1 parent 188cfcb commit 33c22be

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ortools/util/fp_utils.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ bool AreWithinAbsoluteTolerance(FloatType x, FloatType y,
163163
template <typename FloatType>
164164
bool IsSmallerWithinTolerance(FloatType x, FloatType y, FloatType tolerance) {
165165
if (IsPositiveOrNegativeInfinity(y)) return x <= y;
166-
return x <= y + tolerance * std::max(1.0, std::min(std::abs(x), std::abs(y)));
166+
return x <= y + tolerance * std::max(FloatType(1.0),
167+
std::min(std::abs(x), std::abs(y)));
167168
}
168169

169170
// Returns true if x is within tolerance of any integer. Always returns

0 commit comments

Comments
 (0)