Message-ID: <32D09DEC.69DB@gbrmpa.gov.au> Date: Mon, 06 Jan 1997 14:38:40 +0800 From: Leath Muller Reply-To: leathm AT gbrmpa DOT gov DOT au Organization: Great Barrier Reef Marine Park Authority MIME-Version: 1.0 To: "Tony O'Bryan" CC: djgpp AT delorie DOT com Subject: Re: Fixed Point (Optimization) References: <32d0610c DOT 1680703 AT ursa DOT smsu DOT edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > My computer betrays me once again. I rewrote a simple timing program > that merely calculates elapsed time using clock() and divides by > CLK_TCK. _THIS TIME_ I ran it through 500,000 loops just adding 100.0 > to a type double accumulator. Once the floating point loop finished, > I repeated the loop using a type long as my accumulator. On my > Pentium 120, the floating point addition loop was roughly half as fast > as the addition loop. The elapsed time was miniscule, not nearly the > same results I had gotten previously. It should be about half the speed. An FP add takes 3 cycles, and it takes 1 cycle for an int add. Assuming normal simple loop overhead, I would think it would take 4 cycles for an FP add loop, and 2 cycles for an INT one... Leathal.