Opened 9 months ago

Closed 8 months ago

## #13301 closed Bugs (fixed)

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

Reported by: | 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 2^{8} 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)

### Change History (3)

### Changed 9 months ago by

### comment:1 Changed 8 months ago by

### comment:2 Changed 8 months ago by

Resolution: | → fixed |
---|---|

Status: | new → closed |

Fixed in https://github.com/boostorg/multiprecision/commit/a4b198e1b79e735825e15e6bf6572b86e7b8dd3c

Thanks for the report.

**Note:**See TracTickets for help on using tickets.

Confirmed, investigating, thanks.