From 8e2c5f19429f10386524f58bb764d8661098824a Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 16 Nov 2015 17:57:53 +1100 Subject: [PATCH] maths: explanatory header for sign() --- maths.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/maths.hpp b/maths.hpp index e9499a82..1a4c5214 100644 --- a/maths.hpp +++ b/maths.hpp @@ -135,7 +135,8 @@ namespace util { digits (const T& value); - //----------------------------------------------------------------------------- + ///---------------------------------------------------------------------------- + /// return positive or negative unit value corresponding to the input. template constexpr std::enable_if_t< std::is_signed::value && std::is_integral::value, T @@ -145,7 +146,10 @@ namespace util { return t < 0 ? -1 : 1; } - //------------------------------------------------------------------------- + ///------------------------------------------------------------------------ + /// return positive or negative unit value corresponding to the input. + /// guaranteed to give correct results for signed zeroes, use another + /// method if extreme speed is important. template constexpr std::enable_if_t< std::is_floating_point::value, T