True when f0 and f1 differ by at most epsilon (0.0001 unless given). The test is absolute, not relative, and the bound is inclusive.
The Vector2 and Vector3 overloads compare every component with the same epsilon. Any NaN component makes the answer false, and two infinities of the same sign are not close (their difference is NaN).
#import "Math";
assert(values_are_close(1.0, 1.00005));
assert(!values_are_close(1.0, 1.01));
assert(values_are_close(1.0, 1.01, 0.1));
assert(values_are_close(xyz(1, 2, 3), xyz(1, 2, 3.00001)));
assert(!values_are_close(xy(1, 2), xy(1, 3)));values_are_close :: (f0: float, f1: float, epsilon := DEFAULT_EPSILON) -> bool
Parameters
- f0: float
- f1: float
- epsilon := DEFAULT_EPSILON
Returns
- bool
values_are_close :: (
a: Math.Vector2,
b: Math.Vector2,
epsilon := DEFAULT_EPSILON
) -> bool
Parameters
- a: Math.Vector2
- b: Math.Vector2
- epsilon := DEFAULT_EPSILON
Returns
- bool
values_are_close :: (
a: Math.Vector3,
b: Math.Vector3,
epsilon := DEFAULT_EPSILON
) -> bool
Parameters
- a: Math.Vector3
- b: Math.Vector3
- epsilon := DEFAULT_EPSILON
Returns
- bool