Skip to content

Commit d6b7a6c

Browse files
committed
get are_close to work for absolute quantities
1 parent c3777d7 commit d6b7a6c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

p3a_functions.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ auto are_close(Value const& a, Value const& b, Tolerance const& tolerance)
176176
{
177177
using p3a::abs;
178178
auto const difference = abs(b - a);
179-
auto const scale = abs(a) + abs(b);
180-
return difference <= tolerance * p3a::max(scale, Value(1));
179+
auto const scale = abs(a - Value(0)) + abs(b - Value(0));
180+
return difference <= tolerance * p3a::max(scale, Value(1) - Value(0));
181181
}
182182

183183
}

0 commit comments

Comments
 (0)