www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/30/03:50:08

Message-ID: <32269B72.30EF@pobox.oleane.com>
Date: Fri, 30 Aug 1996 09:42:42 +0200
From: Francois Charton <deef AT pobox DOT oleane DOT com>
Organization: CCMSA
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Using inline as to multiply two fixed point #'s
References: <502b8n$eh6 AT crab DOT rutgers DOT edu> <505ctt$aa2 AT agate DOT berkeley DOT edu>

Eric J. Korpela wrote:
> 
> 
> The big question is "Why use fixed point?"  The above takes 16 clocks
> (1 load, 14 execute, 1 store) + call overhead on a pentium.  If you
> use floating point it would take 5 cycles (1 load, 3 execute, 1 store)
> + call overhead.  Even on a 486 it's 21-50 (fixed) versus 25 (fp).
> 

The advantage of fixed over floating point is not in the multiplication 
(even though you may speed them a lot when you do several multiplies and 
divisions, by optimising the number or renormalisations (for a*b/c if the 
values are not too big, you don't renormalize at all...)) but in the 
additions, substraction, comparisons... which 486up machines perform very 
quickly on ints.

As an example, I did such a change a year ago on parts of povray 2.2 
(using fixed point additions and multiplications, #defined as C macros), 
the result was an average 10-15% speed gain...

Regards
Francois


- Raw text -


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