Boost C++ Libraries: Ticket #9013: Create enum to make sign result more readable. https://svn.boost.org/trac10/ticket/9013 <p> The function 'sign' return 1, 0 or -1 depending on the signal of the z, but comparing the result with -1, 0 or 1 constants could make the source code bad readable specially for people that doesn't know what the 'sign' function return. </p> <pre class="wiki">if (math::sign(value) == -1){ .... } </pre><p> I propose to create an enumerate type to test the result of the function with a constant, to create a more readable code. The compatibility with the previous implementation of the function is not broken. </p> <p> Suggested implementation of code: </p> <pre class="wiki">enum Sign { SIGN_NEGATIVE = -1, SIGN_ZERO = 0, SIGN_POSITIVE = 1 } template &lt;class T&gt; inline Sign sign BOOST_NO_MACRO_EXPAND(const T&amp; z) { return (z == 0) ? SIGN_ZERO : (boost::math::signbit)(z) ? SIGN_NEGATIVE : SIGN_POSITIVE; } </pre><p> The previous example comparison could be write as: </p> <pre class="wiki">if (math::sign(value) == math::SIGN_NEGATIVE){ .... } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9013 Trac 1.4.3