[Boost-bugs] [Boost C++ Libraries] #10066: math::round broken for some integer types/values

Subject: [Boost-bugs] [Boost C++ Libraries] #10066: math::round broken for some integer types/values
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-23 12:45:02


#10066: math::round broken for some integer types/values
------------------------------+-------------------------
 Reporter: andrew.bell.ia@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: math
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: |
------------------------------+-------------------------
 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.


 ===========


 {{{

 #include <iostream>
 #include <iomanip>
 #include <math.h>
 #include <boost/math/special_functions/round.hpp>

 int main()
 {
     long l = -1230695498;

     std::cerr << "boost::math::lround(l) = " << std::setprecision(12) <<
         boost::math::lround(l) << "\n";
     std::cerr << "::lround(l) = " <<std::setprecision(12) <<
         ::lround(l) << "\n";
 }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10066>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC