www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/18/07:05:21

Message-ID: <337EE23A.1B36@silesia.top.pl>
Date: Sun, 18 May 1997 13:04:26 +0200
From: Michal <wapex AT silesia DOT top DOT pl>
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: float & ints & triangle3d_f
References: <Pine DOT GSO DOT 3 DOT 96 DOT 970517180056 DOT 23053B-100000 AT linknet DOT kitsap DOT lib DOT wa DOT us>

KaRNaGE wrote:
> 
> i searched the back mail, and from what i read, floats are faster then
> ints, on a pentuim?
Pentium's FPU is NOT faster than CPU. You can't compare those two
thinks, becouse they're complytly different and are being used for
different thinks. What makes pentium's FPU being usefull in some fast
real time calculations is the ability to execute float instructions in
parallel with integer. As the conseqence of this you can waste only 1
clock on arithmetic instructions (fmul is really faster than integer mul
- only 3 clocks!, integer 11 clocks). This can speed thinks a lot.
> ....before i convert all my code to floating point,
There is no need to convert all code to floating point, but only thinks
that can be really improved. You should mix integer with float point
(assembler is the key to really fast coding), but do different
calculations in both, avoid conversions from floats to ints, becouse
they are slow. CPU is much more faster when you don't need the fractal
part of the numbers and you are not using multipications and divisions,
except by the powers of 2.
It's better to use CPU, even when the calculation itself is slower, but
you need to convert result to integer to make use of it.
> i was wondering a few things:
> 
> Are floats still faster then ints on a pentuim pro?
As far as I know, they are usefull in the same cases on PentiumPro as on
Pentium.
> Is comparing floats slower then comparing ints? i.e. if (a < b)
They are much more slower.
> will type casting floats to ints slow my code down?..
> and is triangle3d_f (allegro) faster then the fixed point version on a
> pentuim (i'm assuming it is)?
I don't use Allegro.
> 
> i tried looking with the mail search engine, but i couldn't find any
> straight answers............thankz...

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019