Boost C++ Libraries: Ticket #10066: math::round broken for some integer types/values https://svn.boost.org/trac10/ticket/10066 <p> The current code takes the input (which may be an int type) and adds/subtracts .5f, which may cause precision to be lost as the integer is converted to a float. math::round should essentially be a noop when the input type is integral. </p> <p> =========== </p> <pre class="wiki"> #include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;math.h&gt; #include &lt;boost/math/special_functions/round.hpp&gt; int main() { long l = -1230695498; std::cerr &lt;&lt; "boost::math::lround(l) = " &lt;&lt; std::setprecision(12) &lt;&lt; boost::math::lround(l) &lt;&lt; "\n"; std::cerr &lt;&lt; "::lround(l) = " &lt;&lt;std::setprecision(12) &lt;&lt; ::lround(l) &lt;&lt; "\n"; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10066 Trac 1.4.3 John Maddock Sat, 24 May 2014 08:48:56 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10066#comment:1 https://svn.boost.org/trac10/ticket/10066#comment:1 <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 Git develop. See <a class="ext-link" href="https://github.com/boostorg/math/commit/e6996e118850881ca56b7a9a165fe4f38ab843bc"><span class="icon">​</span>https://github.com/boostorg/math/commit/e6996e118850881ca56b7a9a165fe4f38ab843bc</a> </p> Ticket