Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-05-09 15:09:57


The last time I needed this type of class, I didn't have a floating point
processor, (Intel 486)
The interface allowed the user to pick the underlying data type, and the
number of digits in the exponent. I sent the code to Bill for his perusal.
(It's pretty old and would need boostification.)

FixedPoint<long, 16>

The one optimization was that I made was that for addition/subtraction to
integers I special cased the templates so that I could cast the non
fractional part to a type, as in long,16 -> int, perform the operation.
This optimization would not be obvious to a new C++ user that having the
exponent be a factor of byte size in bits would generate faster/smaller
code.

In this case, we weren't worried about roundoff but rather the need for a
fast floating point operations. Now with a floating point coprocessor this
work has all been shelved.

  -gary-

gary.powell_at_[hidden]

PS
  I would also organize the include files to separate out the io and the
conversions from the basic class. It would work better with an embedded
system which might not have or need the io, or the conversions.


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