#13301 closed Bugs (fixed)

boost multiprecision conversion from binary float to int types fails for large floats

Reported by: marc.alexa@… Owned by: John Maddock
Milestone: To Be Determined Component: multiprecision
Version: Boost 1.64.0 Severity: Problem
Keywords: Cc:


It appears the conversion from binary float types such as

typedef number<cpp_bin_float<8,backends::digit_base_2> > quarter_float;

to integer types fails if the float is 28 or larger. For example, using

quarter_float qf(256);
cpp_int i = qf.convert_to<cpp_int>();
unsigned int n = qf.convert_to<unsigned int>();

I get 0 for i and 4294967295 for n.

A try to attach a full code example.

Attachments (1)

bmc.cc (1.0 KB) - added by marc.alexa@… 12 months ago.

Download all attachments as: .zip

Change History (3)

Changed 12 months ago by marc.alexa@…

Attachment: bmc.cc added

comment:1 Changed 11 months ago by John Maddock

Confirmed, investigating, thanks.

comment:2 Changed 11 months ago by John Maddock

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