From: Paul Shirley Newsgroups: comp.os.msdos.djgpp Subject: floats v doubles myth Date: Mon, 3 Feb 1997 19:57:14 +0000 Organization: wot? me? Lines: 21 Distribution: world Message-ID: References: <32f2a072 DOT 17736424 AT news DOT ionsys DOT com> <32f3a643 DOT 25054189 AT news DOT ox DOT ac DOT uk> Reply-To: Paul Shirley NNTP-Posting-Host: chocolat.foobar.co.uk Mime-Version: 1.0 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <32f3a643 DOT 25054189 AT news DOT ox DOT ac DOT uk>, George Foot writes >Doubles are more accurate and apparently faster than floats. ^^^^^^ Can we *please* kill this myth. On Pentium there is NO speed difference between using a float or double. On 387,486/487 float is slightly *faster* to load, store or read from ram as an operand, than a double. On top of that, you have just consumed 8 bytes of ram bandwidth and cache instead of 4, and imposed extra alignment restrictions on variables (which can cause extra code to be emitted on some compilers). There are times when a 'register long double' (80 bit) is faster than either, *only* because the optimiser is allowed to keep that type in internal fpu registers across calculations. Only do this if you know that transient values will stay on the fpu. On Intel processors only use doubles if you need the precision. --- Paul Shirley: shuffle chocolat before foobar for my real email address