cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/06/10:38:54

From: frabb AT worldaccess DOT nl
Newsgroups: comp.os.msdos.djgpp
Subject: Antw: Re: floats v doubles myth
Date: Thu, 06 Feb 97 09:46:20 GMT
Organization: World Access, Internet, E-mail and Videotex
Lines: 55
Message-ID: <N.020697.104621.02@skn2-8.worldaccess.nl>
References: <32f2a072 DOT 17736424 AT news DOT ionsys DOT com>
<32f3a643 DOT 25054189 AT news DOT ox DOT ac DOT uk> <Jyj5XLAaMk9yEwb1 AT foobar DOT co DOT uk>
<32f8d54a DOT 11671304 AT news DOT ox DOT ac DOT uk>
NNTP-Posting-Host: skn2-8.worldaccess.nl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 5-02-97 20:12, George Foot wrote:

(on float versus double)

> For the record, I threw together a simple test program, which used
> uclock() to time long loops, compiled it with no optimisations, and
> gave the following results:
> 
> 1) 5044716 4715005
> 2) 4813001 5153259
> 
> These are timings for the loop, taken as the difference between
> uclock() values before and after the loop, the subtraction being done
> at the end of the test (not that that matters much). I believe it is a
> fair test. In (1) The first number represents the time taken for a
> float calculation, the second representing the same calculation in
> doubles. In (2) I reversed the declarations.
> 
> The test code was 100000 times through:
> 
>   a=0.358678735;
>   a=sin(a);
>   a=cos(a);
>   a=a*a;
> 
> which (I think) is typical of what most people seem to want floating
> point numbers to do.
> 


using the same values, and adding long double (which is what the hardware fpp 
uses) I got these results on a Pentium 100:

double: 295461
long double: 282135
float: 285784
long double: 282127
double: 295325
float: 285787
float: 285724
double: 295386
long double: 282127
float: 285727
long double: 282187
double: 295325

Obviously, the sequence of the loops has some, but very small, influence. In 
any case, long double is fastest and double slowest. I am not too sure what 
this means, but, as you say, the difference is insignificant.

Frank Abbing

> George Foot


- Raw text -


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