Opened 6 years ago

Closed 6 years ago

#12170 closed Bugs (fixed)

boost::multiprecision::export_bits throws on a negative cpp_int number

Reported by: Tassilo Glander <tassilo.glander@…> Owned by: John Maddock
Milestone: To Be Determined Component: multiprecision
Version: Boost 1.60.0 Severity: Problem
Keywords: export_bits cpp_int Cc:

Description

When calling export_bits on a negative boost::multiprecision number based on cpp_int, an exception is thrown from the internal method msb ("testing individual bits in negative values is not supported").

boost::multiprecision::checked_int128_t i (-1); use negative number std::vector<unsigned char> v; export_bits(i, std::back_inserter(v), 8); throws

export_bits is designed to be used for data exchange, so must export valid data.

Attachments (1)

exportbits_negativeNumber.cpp (254 bytes ) - added by Tassilo Glander <tassilo.glander@…> 6 years ago.

Download all attachments as: .zip

Change History (2)

by Tassilo Glander <tassilo.glander@…>, 6 years ago

comment:1 by John Maddock, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.