Boost logo

Boost :

Subject: Re: [boost] [fixed_point] First presentation from GSoC 2015 and more
From: Christopher Kormanyos (e_float_at_[hidden])
Date: 2016-10-06 15:48:06


>>>> 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.
Thank you.
The original proposal specifies the types negatable,nonnegative, cardinal and another one I forgot. I agree thatthe unsigned type would be nice to have. So that one iscalled nonnegative. I haven't figured out how nonnegativeshould interact with math functions and/or with negatable.
> 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.
Shift operators are not present at the moment.We can look into this.

> 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.
Thank you for the input. Let's wait for some more commentsand see if this is something we should support.
Best regards, Chris.
 

    On Thursday, October 6, 2016 3:16 PM, Klemens Morgenstern <klemens.morgenstern_at_[hidden]> wrote:
 

 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.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

   


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