On Jan 19, 3:02 pm, (EMail Removed) wrote:
> Hi,
>
> I had to write a class which would emulate FPU using normal fixed point
> operations, and to test it in some real application. I thought about
> some encoding programs but I don't have much idea, which one would be
> suitable. I mean that 1. it would use FPU a lot  to be able to see
> some difference in time, 2. it would be relatively easy to change the
> source code to accept my class (which is written in C++). If you've got
> any idea, please help, I would really appreciate it.
It might be of interest to compare different kinds of operations, for
example + and  are usually quite fast (talking float/double here)
while * and / can take some time. So perhaps you can start of by
creating some synthetic benchmarks, use some random routine to produce
a list of say 1000 FP numbers, for each of them create a double version
and a yourtype version and put them in an array. Then comes the
benchmark: first measure the time it takes to perform some operation
(summing) the doubles then measure the time needed to do the same
operation on your types.
If you want more realistic benchmarks try finding an algorithm for
solving systems of linear equations and implement it. Use a typedef for
the type used in the calculations so you can easily switch (given that
yourtype have similar interface as float/double) and then download a
matrix from the next and try to solve the system (it's a O(n^3)
operation for simple algorithms). I'd recommend a matrix of size
somewhere between 500x500 to 5000x5000, it's better to run the test
many times than taking a too large matrix.

Erik Wikström
