diff --git a/include/lol/private/types/real.h b/include/lol/private/types/real.h index 7eb6ea59..a9aa6221 100644 --- a/include/lol/private/types/real.h +++ b/include/lol/private/types/real.h @@ -157,6 +157,7 @@ public: template friend real_t fract(real_t const &x); template friend real_t degrees(real_t const &x); template friend real_t radians(real_t const &x); + template friend int sign(real_t const &x); // Additional functions template friend real_t franke(real_t const &x, diff --git a/include/lol/private/types/real.ipp b/include/lol/private/types/real.ipp index 867068fd..40b2abfa 100644 --- a/include/lol/private/types/real.ipp +++ b/include/lol/private/types/real.ipp @@ -1007,6 +1007,11 @@ template real_t radians(real_t const &x) return x * mul; } +template int sign(real_t const &x) +{ + return x.is_zero() ? 0 : x.is_negative() ? -1 : 1; +} + template real_t fast_log(real_t const &x) { /* This fast log method is tuned to work on the [1..2] range and