Boost logo

Boost :

Subject: Re: [boost] [fixed_point] First presentation from GSoC 2015 and more
From: Klemens Morgenstern (klemens.morgenstern_at_[hidden])
Date: 2016-10-06 09:15:00


Am 06.10.2016 um 00:07 schrieb Christopher Kormanyos:
>>> A partial implementation of fixed-point in a Boost-like
>>> style based on proposal N3352 is now available.
>
>> ... But your links don't work, I guess you need to > post them directly into the mail.
> Thanks. I think the docs link is broken.I will look into correcting this with the co-authors.
> Best regards, Chris
>

I looked over the pdf Paul Bristow shared, and it looks awesome, though
I'd think you'll also need the unsigned variant. I searched for an easy
solution for the notation for signed/unsigned and what you can do is use
a plain `signed` or `unsigned` as a template parameter, which yields
`signed int` and `unsigned int`. That does allow syntax like this:
`fixed_point<42, -6, unsigned>(42)` which is quite neat I think.

Maybe I missed that, but shift operators would be neat. I.e. "static"
shift operators, that is:

fp<7, 5> x = 1.0;
auto shifted = x >> c<1>; //type = fp<7,4>, but the underlying value is
the same.

Another thing I worked on, was a literal operator, using the
`template<char...> operator"` overload. So you could automatically
determine the needed fixed-point type:

auto x = 5.25_fp; //yields fp<6,2>

I'd have to look how good my code was there, but if you´re interested I
could work on that, to integrate it into your library.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk