Yes - this looks potentially rather useful for some tasks, especially embedded
systems.
Why on earth didn't the language include fixed point and/or fractional types?

As you observe, the increased accuracy compared to float (just a little too
small for some measurements like weights) but with half the memory of double,
and of course the integer/binary nature are sometimes useful.

Do you have any test programs?

Have you made any comparison with float and double speeds?

HTH to encourage you.

Paul

Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB  UK
+44 1539 561830   Mobile +44 7714 33 02 04
Mobile mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Kevin Atkinson
> Sent: Thursday, February 27, 2003 2:29 AM
> To: Boost mailing list
> Subject: [boost] Is there any Interest in a Fixed Point Library?
>
>
>
> Is there any interest in a fixed point math library.  Using templates the
> compiler can keep track of the radix point for you making using fixed
> point math a lot less tedious and error prone.
>
> Attached is a rudimentary implementation which would work acceptably when
> the exponent is not too large or too small.  If the exponent is smaller or
> larger than the size of the underlying integer in bits this code will
> likely behave badly.
>
> I plan to use the attached code to avoid having to deal with serializing
> floating point numbers.  A exponent of -30 (-31 if using an unsigned 32
> bit integer) is especially useful for representing numbers between 0 and
> 1.  The precision will actually be a bit better than a 32 bit float since
> the exponent does not have to be stored.
>
> Comments on the code welcome.  I am not a numerical analysis specialist so
> don't expect me to write a fixed point library for anything beyond simple
> arithmetic.
>
> --
> http://kevin.atkinson.dhs.org
>

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

Reply via email to