Boost logo

Boost :

Subject: Re: [boost] [fixed-pt] (was [Review Request] Multiprecision Arithmetic Library)
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2012-04-04 18:48:49

Vicente J. Botet Escriba wrote:

> Le 04/04/12 13:17, Neal Becker a écrit :
>> Here is my current run-time fixed-pt. In this version, fixed-pt bit widths
>> are
>> set at run-time, becuase I use this from python. It is simple to convert
>> this to compile-time if desired.
>> The code is based on the boost::constrained_value
> Hi,
> I have no doubt of the utility of a fixed point library with constraints
> given at run-time, but I will prefer that the interface be based on
> Range and Resolution (as in
> instead of in IntegerBits and FractionalBits.
> I need sometimes to have fixed points that have less bits than
> fractional bits and give negative numbers for IntegerBits or
> FractionalBits seems to me counterintuitive. Of course this is just a
> point of view and conversion between the different formats could be
> provided by the library.
> Best,
> Vicente

1. It's easy to convert to compile-time constraints. Actually, this code was
compile-time, and I converted to run-time.

2. I use this code for modelling fixed point hardware design (FPGA). In that
case, we must be very explicit about the bit widths of every operation, and
every temporary result. One reason I prefer not to have any automatic
promotion. Also because, only in simple cases can the compiler guess the
correct sizes needed for results, so it's better for the user to be forced
to be explicit.

Boost list run by bdawes at, gregod at, cpdaniel at, john at