coord/ops: assert when normalising zero coords

This commit is contained in:
Danny Robson 2016-10-12 22:58:13 +11:00
parent 9a798446b5
commit 2c6011394f

View File

@ -19,8 +19,9 @@
#include "./fwd.hpp" #include "./fwd.hpp"
#include "../preprocessor.hpp" #include "../debug.hpp"
#include "../maths.hpp" #include "../maths.hpp"
#include "../preprocessor.hpp"
#include "../types/bits.hpp" #include "../types/bits.hpp"
#include <cmath> #include <cmath>
@ -489,7 +490,10 @@ namespace util {
K<S,T> K<S,T>
normalised (const K<S,T> &k) normalised (const K<S,T> &k)
{ {
return k / norm (k); auto n = norm (k);
CHECK_NEZ (n);
return k / n;
} }