Subject: Re: [boost] [fixed_point] Request for interest in a binary fixed point library
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-04-10 19:01:41
Le 10/04/12 22:54, Christopher Kormanyos a écrit :
>>> the recent discussion on the MultiplePrecission Arithmetic library has show that some people has its ow fixed point library.
>>> Is there an interest in a Boost library having as base
> Yes! Absolutely interested!
> I use fixed-point extensively with hard real-time microcontroller systems.
> I am particularly interested in stuff like a 7.8 and 15.16 signed split.
What 7.8 stands for? 7 bits for the integer part and 8 for the
I guess you prefer a specific class for signed fixed_points and not a
Do you mind if the library propose some meta-function to specify
different formats, e.g.
format_i_f<7,8>::type and format_i_f<15,16>::type
An alternative design is to have a format parameter, so for example the
user could use specific formats
where i_f has as parameters the number of integral and fractional bits
and r_r has as parameters the range and resolution. Currently my
prototype and the C++ proposal uses this r_r format. Others use the
total number of bits (width including the sign) and the fractional w_f
The advantage of the meta-function is that the library is open to
unknown formats. The liability is the need of ::type (not realy with
The liability of the format template parameter is that while
fp<i_f<7,8>> and fp<r_r<7,-8>> are equivalent they are not the same type
and again ::type should be needed.
My preference is of course the implicit r_r format and the use of
meta-functions for the other formats.
> I always use signed fixed-point and always use a split right
> down the middle of the representation. It keeps the math simple
> and fast.
Do you mind if the rounding strategy is a template parameter? An
enumeration or and open policy?
Do you have any preferences for the namespace and class names?
> Good luck with this project. Looking forward to it.
> I will look into the prelim code later.
Any comment is welcome.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk