[Boost-bugs] [Boost C++ Libraries] #8126: multiprecision, incorrect sign

Subject: [Boost-bugs] [Boost C++ Libraries] #8126: multiprecision, incorrect sign
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-02-20 21:44:06


#8126: multiprecision, incorrect sign
--------------------------------------------------+-------------------------
 Reporter: Stepan Podoskin <stepik-777@…> | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.53.0
 Severity: Problem | Keywords:
--------------------------------------------------+-------------------------
 This program outputs "-1" instead of "1".

 Tested on 32-bit machine with GCC 4.7.2 and MSVC 2010 (boost 1.53.0).
 {{{

 #include <iostream>
 #include <boost/multiprecision/cpp_int.hpp>
 using boost::multiprecision::cpp_int;

 int main()
 {
     cpp_int a("-4294967296");
     cpp_int b("4294967296");
     cpp_int c("-1");
     std::cout << (a/b)*c << '\n'; // prints "1" (correct)
     a = (a/b)*c;
     std::cout << a; // prints "-1" (incorrect)
     return 0;
 }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8126>
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:12 UTC