Boost C++ Libraries: Ticket #2473: unsigned integers going into interval of doubles get wrongly negated https://svn.boost.org/trac10/ticket/2473 <p> interval&lt;double&gt; x(1U) gets wrong lower bound (-2<strong>32+1 instead of 1). Apparently, the unary - operation is performed on the unsigned int instead of the double. </strong></p> <p> Workaround: manually cast to double before creating the interval. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2473 Trac 1.4.3 David Monniaux <David.Monniaux@…> Tue, 04 Nov 2008 13:12:55 GMT attachment set https://svn.boost.org/trac10/ticket/2473 https://svn.boost.org/trac10/ticket/2473 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bug_unsigned_boost.cc</span> </li> </ul> <p> very short example exhibiting bug </p> Ticket Gunter Thu, 12 Mar 2009 22:24:27 GMT <link>https://svn.boost.org/trac10/ticket/2473#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2473#comment:1</guid> <description> <p> This problem causes the failure of test7 of ublas. I'd appreciate if someone finds time to fix it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Thu, 12 Mar 2009 22:49:51 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2473#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2473#comment:2</guid> <description> <p> I tracked the source of the problem down to rounded_arith.hpp:93 where (-v) is computed although the type of v is and unsigned integer. </p> <p> Additionally I wonder why the constructor of interval&lt;T&gt; is template &lt;T1, T2&gt; interval(T1, T2) and not simply interval(T,T). The latter constructor would enforce the conversion to the correct type and prevent the shown bug. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Thu, 02 Apr 2009 22:36:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2473#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2473#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/52147" title="ublas/doc/samples/ex_triangular.cpp: added new example ...">[52147]</a>) ublas/doc/samples/ex_triangular.cpp: added new example ublas/doc/samples/Jamfile.v2: added build section for ex_triangular ublas/doc/container_concept.htm: fixed wrong description of array_type ublas/doc/triangular.htm: fixed lower/upper confusion and added link to ex_triangular </p> <p> ublas/test/test_lu.cpp: added unit test for LU decomposition ublas/test/triangular_access.cpp: added unit test for accessing triangular/symmetric matrices ublas/test/triangular_layout.cpp: added unit test for testing storage layout of triangular/symmetric matrices ublas/test/common/testhelper.hpp: support routines for new unit tests </p> <p> ublas/test/CMakeLists.txt: added new tests (still experimental) test_lu, triangular_access. triangular_layout </p> <p> ublas/test/Jamfile.v2: </p> <blockquote> <p> added new tests (still experimental) test_lu, triangular_access. triangular_layout disabled broken test7 (maybe a fix of boost::interval is needed, see <a class="new ticket" href="https://svn.boost.org/trac10/ticket/2473" title="#2473: Bugs: unsigned integers going into interval of doubles get wrongly negated (new)">#2473</a>) </p> </blockquote> <p> ublas/test/test71.cpp, ublas/test/test73.cpp, ublas/test/test7.cpp: </p> <blockquote> <p> added first fixes to support boost::interval as scalar type </p> </blockquote> <p> ublas/test/common/init.hpp: </p> <blockquote> <p> initialize all matrices/vectors with floats instead of (unsigned) ints this helps to fix broken test7 for boost::interval </p> </blockquote> </description> <category>Ticket</category> </item> </channel> </rss>