www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/16/10:22:16

Date: Mon, 16 Nov 1998 17:19:07 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Toni Rasanen <torasane AT mail DOT student DOT oulu DOT fi>
cc: djgpp AT delorie DOT com
Subject: Re: Float optimization?
In-Reply-To: <Pine.SGI.3.95.981116114410.24339B-100000@paju.oulu.fi>
Message-ID: <Pine.SUN.3.91.981116171455.8995E-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Mon, 16 Nov 1998, Toni Rasanen wrote:

> First, should I use float or double as my innerloop variables?

My advice is to always use double, unless you have large arrays and 
memory is at premium.

> Which one is actually faster, or do they have any difference?

There should be no significant difference, since the FPU does everything 
in 80-bit long double format, and converts it to float or double only 
when it stores data in memory.

Computations with floats are much less accurate (slightly more than 6 
significant digits), so complex computations might produce unexpected 
results unless you are very careful in writing the code.

- Raw text -


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