delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/20/17:12:26

From: kurt DOT skauen AT funcom DOT com (Kurt Skauen)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: floating point is... fast???
Date: Mon, 20 Jan 1997 17:09:47 GMT
Organization: Funcom production A/S
Lines: 27
Message-ID: <853780174.909237@araga.funcom.com>
References: <5brd2e$dap AT lyra DOT csx DOT cam DOT ac DOT uk> <32e22337 DOT 2066519 AT ursa DOT smsu DOT edu> <5bvjeb$mji AT lyra DOT csx DOT cam DOT ac DOT uk>
Reply-To: kurt DOT skauen AT funcom DOT com
NNTP-Posting-Host: araga.funcom.com
Cache-Post-Path: araga.funcom.com!unknown AT 193 DOT 71 DOT 100 DOT 211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

gpt20 AT thor DOT cam DOT ac DOT uk (G.P. Tootell) wrote:
>i would be better writing - (and changing a to a float)
>
>a=1.0/b;	(because fdiv is still faster than idiv in most cases)
>c=(float)x*a;
>d=(float)y*a;
>
>ie. to change the integers into floating wherever possible to make use of the
>fmul timings, which outstrip every other timing even in worst case!
>
>
>so there must be a catch somewhere of course ;)
>perhaps the changing from float->int and vice versa takes a lot of time?
>anyone?

I don't have the excact numbers, but float to int, and int to float
conversions are supposed to be very slow. So normaly it is a good idea
to avoid them. But since the FPU can process one instruction in
parallel with the CPU (four on Cyrics I heard?), you can execute all
FPU instrucions on *ONE* cycle as long as you have enough integer
instructions to fill in between each FPU instruction.

Kurt. 	Programmer Funcom/R&D
The above expressions is not ment to represent Funcom.


- Raw text -


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