Opened 10 years ago

Closed 10 years ago

#8145 closed Bugs (fixed)

multiprecision, negative integer zero

Reported by: Stepan Podoskin <stepik-777@…> Owned by: John Maddock
Milestone: To Be Determined Component: multiprecision
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Here is me again :)

Introduced in revision 83080:

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

int main()
{
    cpp_int c = -1 + cpp_int(0) + 1;
    if( c != 0 )
        std::cout << c; // c = -0
    return 0;
}

Change History (2)

comment:1 by John Maddock, 10 years ago

Confirmed, many thanks for keeping me on my toes with these!!

comment:2 by John Maddock, 10 years ago

Resolution: fixed
Status: newclosed

(In [83103]) Fix bug in subtraction routine that leads to -0 rather than 0. Add test cases. Fixes #8145.

Note: See TracTickets for help on using tickets.