
Boost : 
Subject: Re: [boost] [fixed_point] Request for interest in a binary fixed point library
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 20120410 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
>>> http://www.openstd.org/jtc1/sc22/wg21/docs/papers/2012/n3352.html?
>> Vicente
> Yes! Absolutely interested!
> I use fixedpoint extensively with hard realtime 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
fractional part?
I guess you prefer a specific class for signed fixed_points and not a
template parameter.
sfp<7,8>
versus
fp<int16_t, 7,8>
Do you mind if the library propose some metafunction 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
fp<i_f<7,8>> a;
fp<r_r<7,8>> b;
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
fp<w_f<16,8>> b;
The advantage of the metafunction is that the library is open to
unknown formats. The liability is the need of ::type (not realy with
template aliases)
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
metafunctions for the other formats.
> I always use signed fixedpoint 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.
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk