Opened 4 weeks ago

#13301 new Bugs

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) (1.0 KB) - added by marc.alexa@… 4 weeks ago.

Download all attachments as: .zip

Change History (1)

Changed 4 weeks ago by marc.alexa@…

Attachment: added

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain John Maddock.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.