Opened 5 years ago

Closed 5 years ago

#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:

Description

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@… 5 years ago.

Download all attachments as: .zip

Change History (3)

by marc.alexa@…, 5 years ago

Attachment: bmc.cc added

comment:1 by John Maddock, 5 years ago

Confirmed, investigating, thanks.

comment:2 by John Maddock, 5 years ago

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