www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/29/06:22:02

From: gpt20 AT thor DOT cam DOT ac DOT uk (G.P. Tootell)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Optimization
Date: 29 Nov 1996 10:59:02 GMT
Organization: University of Cambridge, England
Lines: 20
Sender: gpt20 AT hammer DOT thor DOT cam DOT ac DOT uk (G.P. Tootell)
Message-ID: <57mflm$bta@lyra.csx.cam.ac.uk>
References: <57hg9b$or5 AT kannews DOT ca DOT newbridge DOT com> <329C4CD4 DOT 7474 AT cornell DOT edu> <Pine DOT SUN DOT 3 DOT 90 DOT 961127095705 DOT 25056B-100000 AT coop10> <329C62F6 DOT 23F6 AT stud DOT warande DOT ruu DOT nl> <329E2E2B DOT 3D02 AT gbrmpa DOT gov DOT au>
NNTP-Posting-Host: hammer.thor.cam.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

|> Actually, this is even faster if you:
|> 	c = 1 / (x * y);
|> 	a1 = b1 * c;
|> 	a2 = b2 * c;
|> 	a3 = b3 * c;
|> A divide takes 39 cycles on a normal double divide, a mul takes 3
|> cycles.
|> Using your method, you have 3 divides (117 cycles) and one mul for 120
|> cycles.
|> Using the second method, you have 39 + 9 cycles, or 48... :) 
|> 
|> Leathal.

except you forgot that if c isn't a float then you may well round the value of c
down so much as to adversely affect the calculation of a1-3.
and if c is a float then the code probably becomes slower than before i dunno.

nik

-- 

- Raw text -


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