|
Boost : |
From: Stephen Nutt (snutt_at_[hidden])
Date: 2002-09-12 22:51:15
Hi Fernando,
I've not done too much to the fixed_binary class recently, so still nothing
to show. I have decided to use an arithmetic class, in some attempt to
allow people to use non builtin integral types. I don't know how well this
will work in practice as I'm using MSVC++, which I'm already pushing to the
limits of it abilities.
Speed should be good for builtin types. I just compiled
boost::fixed_math<short, 0, int, 2>::multiply (a, b)
with full optimisations and the assembler looked pretty reasonable. (This
multipled the two fixed point numbers a and b. a is a short with 0 binary
digits, and b is an int with 2 binary digits.)
Unfortunatly things get more complex if you do
boost::fixed_math<int, 2, int, 2>::multiply (a, b)
as the calculation must be done using an intermediate 64 bit integer. Still
isn't too bad
boost::fixed_math<int64_t, 2, int64_t, 2>::multiply (a, b)
however is slow as it requires three 64 bit multiplications, three 64 bit
shifts and two 64 bit adds.
Addition and subtraction are as fast as expected. Division is yet to be
completed, and will suffer similar performace issue to multiplication when
dealing with int's an 64 bit numbers.
Thanks for the offer to test and review. I'll contact you when it is ready.
Stephen
----- Original Message -----
From: "Fernando Cacciola" <fcacciola_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, September 11, 2002 8:50 AM
Subject: Re: [boost] Re:(boost) Fixed point integer template library
> Hi Stephen,
>
> Although I don't have right now a need for a binary fixed point class, I
do
> believe that it will be a great addition to boost, so I will be happy to
> review and test it as soon as you have it ready.
>
> Regards,
>
> BTW: Seems that we are about to have quite a complete set of numeric types
> in boost.
> AFAICT, there are also two quite common number types that I can't recall
> anyone submitting:
>
> arbitrary/extended precision floating point
> algebraic numbers.
>
> Anyone?
>
> Fernando Cacciola
> Sierra s.r.l.
> fcacciola_at_[hidden]
> www.gosierra.com
>
>
>
> _______________________________________________
> 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