Subject: [Boost-bugs] [Boost C++ Libraries] #12881: Reducing the precision integer division in VS 2015 and above
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-03-01 15:03:46
#12881: Reducing the precision integer division in VS 2015 and above
------------------------------+----------------------------
Reporter: runc | Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
Version: Boost 1.63.0 | Severity: Problem
Keywords: |
------------------------------+----------------------------
The result of the following code is different in VS 2013 and VS
2015:[[br]]VS 2013 output "6"[[br]]VS 2015 output "5.9999999..9977"[[br]]
{{{
#include <iostream>
#include <boost/multiprecision/cpp_dec_float.hpp>
int main()
{
boost::multiprecision::cpp_dec_float_50 num = 180;
boost::multiprecision::cpp_dec_float_50 res = num / 30;
std::cout.precision(100);
std::cout << res;
std::getchar();
return 0;
}
}}}
The difference is explained by the presence in the file
"boost\multiprecision\detail\default_ops.hpp" 2 block of code with
check
{{{
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1900)
...
#endif
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12881> 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-03-01 15:08:01 UTC