If you want full precision why don't you use fractions? The current
implementation of FixedPoint does not perform fixed point calculations.
If you want to fixed point calculations, you must send #roundToScale
after each operation. My preference is to have the FixedPoint class
represent fixed point numbers and the Fraction class represent fractions.
+1
Precisely the key point. Let FixedPoint actually represent fixed point
numbers.
Yes, that makes more sense from an engineering point of view.
FixedPoint is used a lot in the domain of control engineering and
automation, especially when the target hardware only support integer
computations at full speed (there is no floating point unit). Many
PLCs, microcontrollers and recently FPGA's belong to this category.
Here the fixedpoint is a good alternative for a floatingpoint
representation of real numbers or fractions, and it is used to
1. mimic the behavior of the integer computations in design and
simulation tools
2. performs the actual code for the integer computations on the target
hardware
The fixedpoint number is defined with respect to a certain
base (2 or 10), and contains a number of bits, and either a
scale&offset or a
shift. Here is a nice example of the use of fixedpoint numbers in
engineering:
http://www.mathworks.com/products/fixed/
I hope this helps the discussion further,
Paul
------------------
ir. Paul Weustink
Software & systems engineer
Controllab Products
The Netherlands
[hidden email]
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc