www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/04/06:27:31

From: Paul Shirley <Paul AT foobar DOT co DOT uk DOT chocolat>
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: <Jyj5XLAaMk9yEwb1@foobar.co.uk>
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 <junk AT defeating DOT email DOT address>
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
<mert0407 AT sable DOT ox DOT ac DOT uk> 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

- Raw text -


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