Boost C++ Libraries: Ticket #12500: cpp_bin_float default value is NaN. But should be 0 according to the documentation. https://svn.boost.org/trac10/ticket/12500 <p> What should be: "Default constructed cpp_bin_floats have a value of zero." <a href="http://www.boost.org/doc/libs/1_61_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_bin_float.html">http://www.boost.org/doc/libs/1_61_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_bin_float.html</a> </p> <p> This seems quite natural and convenient. </p> <p> But in reality the default constructor seems to make NaN. And its code seems to confirm that as far as I can see: </p> <p> cpp_bin_float() : m_data(), m_exponent(exponent_nan), m_sign(false) {} </p> <p> As a result cpp_bin_float can't be used with boost::numeric::ublas::symmetric_matrix. </p> <p> E.g. in boost\numeric\ublas\functional.hpp </p> <p> in struct matrix_norm_inf </p> <p> in real_type u = real_type (); </p> <p> it is expected that the default value is 0. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12500 Trac 1.4.3 alex@… Wed, 05 Oct 2016 02:12:57 GMT <link>https://svn.boost.org/trac10/ticket/12500#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12500#comment:1</guid> <description> <p> To be more precise the default constructor code is: </p> <p> cpp_bin_float() BOOST_MP_NOEXCEPT_IF(noexcept(rep_type())) : m_data(), m_exponent(exponent_nan), m_sign(false) {} </p> <p> After I have adjusted it in my local copy of boost: </p> <p> cpp_bin_float() BOOST_MP_NOEXCEPT_IF(noexcept(rep_type())) : m_data(), m_exponent(exponent_zero), m_sign(false) {} </p> <p> it seems to create zeroes. That is I've replaced exponent_nan with exponent_zero. I am just not sure if this adjustment is sufficient and consistent. </p> <p> Thank you </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 24 Oct 2016 16:52:58 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12500#comment:2 https://svn.boost.org/trac10/ticket/12500#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> Fixed in <a class="ext-link" href="https://github.com/boostorg/multiprecision/commit/75dc2ebb331746e57b6f1ff313f3c6e3407658ab"><span class="icon">​</span>https://github.com/boostorg/multiprecision/commit/75dc2ebb331746e57b6f1ff313f3c6e3407658ab</a> </p> <p> Thanks! </p> Ticket Michael Shatz Mon, 31 Oct 2016 13:10:28 GMT <link>https://svn.boost.org/trac10/ticket/12500#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12500#comment:3</guid> <description> <p> It's a pity. I like a previous behavior. May be, it was contradiction docs, but it was great for debugging. </p> </description> <category>Ticket</category> </item> </channel> </rss>