Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11328 closed Bugs (fixed)

Regression in multiprecision::cpp_int comparison

Reported by: chfast@… Owned by: John Maddock
Milestone: Boost 1.59.0 Component: multiprecision
Version: Boost 1.58.0 Severity: Regression
Keywords: Cc:

Description

The comparison of 2 values of different cpp_int types in the following program produces incorrect result:

#include <boost/version.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>

using bigint = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<>>;
using u128 =  boost::multiprecision::number<boost::multiprecision::cpp_int_backend<128, 128, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>;

int main()
{
        u128 a = 14;
        bigint b = bigint("115792089237316195423570985008687907853269984665640564039457584007913129639948");
        auto correct = a < b;

        std::cout << "Boost " << BOOST_VERSION << " : " << correct << std::endl;
        return !correct;
}

Versions affected: 1.58+.

Attachments (1)

bigint.cpp (609 bytes ) - added by Paweł Bylica <chfast@…> 7 years ago.
Test program

Download all attachments as: .zip

Change History (5)

by Paweł Bylica <chfast@…>, 7 years ago

Attachment: bigint.cpp added

Test program

comment:1 by John Maddock, 7 years ago

Confirmed, investigating.

comment:3 by anonymous, 7 years ago

How this change is going to be released? In boost 1.59?

comment:4 by John Maddock, 7 years ago

Milestone: To Be DeterminedBoost 1.59.0

How this change is going to be released? In boost 1.59?

Yes, that's the plan.

Note: See TracTickets for help on using tickets.