Mail Archives: djgpp/1997/05/13/15:59:54
quark wrote:
> I've read the Michael Abrash text.. and.. well..
> I still think that integer math is faster... I had
> few floting point programs which doubled their
> speed once I converted them to integer math...
>
> and I have a Pentium. and a 486. pentium is better
> with floting point numbers than the 486, but nothing
> beats clean integer math.
>
> I mean... who would use floting numbers in a simple
> line algorithm... everybody wants the "all integer, no shifting"
> aproach...... why? wouldn't it be easier just to write
> the thing with floting point number?
>
> >Robert Blum wrote:
> >>
> >> Duh.. That must have been from a very old source of information. On
> >> the Pentium (I assume you use one), FP is even faster than integer
> >> performance.
FP arithmetic isn't faster than pure integer, allmost every fp operation
takes more clock cycles than the integer operations.
What makes the FP faster in some reasons, that in the pentium family, the
FP unit can execute instructions paralell with the integer unit, so you can
execute integer operations, while a fp operation runs "on the background".
So when you read an FDIV takes only one cycle, it means, it takes 27 or 37
cycles (sorry i don't know exactly), but your program can make some usefull
integer arithmetic meantime....
So if you need the evaluated value in the next line of code, than fp will
be really slow, but with carrefuly coding, and with mixing integer and fp
operations, you can get nice speedups.
Gyorgy Abonyi Jr.
loop AT hu DOT bonus DOT com
http://www.hu.bonus.com/~loop
- Raw text -