coord/ops: use the coord type for literal equality comparisons
This commit is contained in:
parent
79d19b4f4f
commit
3b3f9cd3d3
@ -738,7 +738,7 @@ namespace util {
|
|||||||
bool
|
bool
|
||||||
is_normalised (const K &k)
|
is_normalised (const K &k)
|
||||||
{
|
{
|
||||||
return almost_equal (norm2 (k), 1);
|
return almost_equal (norm2 (k), typename K::value_type{1});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ main (void)
|
|||||||
tap.expect_eq ( p, p, "unary point addition");
|
tap.expect_eq ( p, p, "unary point addition");
|
||||||
|
|
||||||
auto vec = util::vector4f (0.5f);
|
auto vec = util::vector4f (0.5f);
|
||||||
tap.expect_eq (vec, util::normalised (vec), "normalisation of normalised vector");
|
tap.expect (util::almost_equal (vec, util::normalised (vec)), "normalisation of normalised vector");
|
||||||
|
|
||||||
tap.expect_eq (sum (util::vector4f::ones ()), 4.f, "elementwise summation");
|
tap.expect_eq (sum (util::vector4f::ones ()), 4.f, "elementwise summation");
|
||||||
|
|
||||||
|
@ -89,5 +89,8 @@ main (int, char **) {
|
|||||||
test_single (tap);
|
test_single (tap);
|
||||||
test_double (tap);
|
test_double (tap);
|
||||||
|
|
||||||
|
tap.expect (util::almost_equal (1.f, 1), "trivial float/int almost-equality");
|
||||||
|
tap.expect (util::almost_equal (1, 1.f), "trivial int/float almost-equality");
|
||||||
|
|
||||||
return tap.status ();
|
return tap.status ();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user