Mail Archives: djgpp/1996/08/30/03:50:08
Eric J. Korpela wrote:
>
>
> The big question is "Why use fixed point?" The above takes 16 clocks
> (1 load, 14 execute, 1 store) + call overhead on a pentium. If you
> use floating point it would take 5 cycles (1 load, 3 execute, 1 store)
> + call overhead. Even on a 486 it's 21-50 (fixed) versus 25 (fp).
>
The advantage of fixed over floating point is not in the multiplication
(even though you may speed them a lot when you do several multiplies and
divisions, by optimising the number or renormalisations (for a*b/c if the
values are not too big, you don't renormalize at all...)) but in the
additions, substraction, comparisons... which 486up machines perform very
quickly on ints.
As an example, I did such a change a year ago on parts of povray 2.2
(using fixed point additions and multiplications, #defined as C macros),
the result was an average 10-15% speed gain...
Regards
Francois
- Raw text -