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: | 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)
Change History (2)
by , 6 years ago
Attachment: | exportbits_negativeNumber.cpp added |
---|
comment:1 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fixed as part of: https://github.com/boostorg/multiprecision/commit/efbb9e272dba0cf03ed525e3de0292131f1dc378