Boost C++ Libraries: Ticket #3052: math::signbit fails to report -0 https://svn.boost.org/trac10/ticket/3052 <p> math::signbit fails to report -0. Observed from boost::units, IEEE 754 handling </p> <pre class="wiki">#include &lt;boost/math/special_functions/sign.hpp&gt; #include &lt;iostream&gt; #include &lt;math.h&gt; int main(void) { float i=copysign(0.,-1.); float j=boost::math::copysign(0.,-1.); std::cout &lt;&lt; "i: " &lt;&lt; i &lt;&lt; ", signbit: " &lt;&lt; std::signbit(i) &lt;&lt; "\n"; std::cout &lt;&lt; "j: " &lt;&lt; j &lt;&lt; ", signbit: " &lt;&lt; boost::math::signbit(j) &lt;&lt; "\n"; return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3052 Trac 1.4.3 tegtmeye@… Tue, 19 May 2009 19:44:32 GMT <link>https://svn.boost.org/trac10/ticket/3052#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3052#comment:1</guid> <description> <p> Sorry, reports on my machine [Mac 10.5, gcc version 4.0.1 (Apple Inc. build 5490)] </p> <pre class="wiki">i: -0, signbit: 1 j: -0, signbit: 0 </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 20 May 2009 17:16:29 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3052#comment:2 https://svn.boost.org/trac10/ticket/3052#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I believe this has already been fixed in Trunk - unfortunately it didn't make the last release - should make the next one though. </p> <p> I'm closing this for now, but please reopen if the version of sign.hpp here: <a class="ext-link" href="https://svn.boost.org/trac/boost/browser/trunk/boost/math/special_functions/sign.hpp"><span class="icon">​</span>https://svn.boost.org/trac/boost/browser/trunk/boost/math/special_functions/sign.hpp</a> doesn't fix the issue. </p> Ticket