delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/20/14:16:59

From: Ian D Romanick <idr AT cs DOT pdx DOT edu>
Message-Id: <199701201847.KAA27949@sirius.cs.pdx.edu>
Subject: Re: floating point is... fast???
To: chambersb AT juno DOT com (Benjamin D Chambers)
Date: Mon, 20 Jan 1997 10:47:50 -0800 (PST)
Cc: djgpp AT delorie DOT com
In-Reply-To: <19970120.094829.4983.1.chambersb@juno.com> from "Benjamin D Chambers" at Jan 20, 97 12:49:20 pm
MIME-Version: 1.0

> >Yes, floating point is faster because imul and idiv use the floating
> >point unit to do the operations - thus an integer mul/divide has the
> >overhead of converting the int -> float, div/mul, then float -> int.
> >Whereas the floating point calculations just do the div/mul...
> 
> If this were true, I couldn't do ANY multiplication/division on my
> computer, since I have no FPU (I'm not counting Emulators here).
> The integer mul/div routines are so slow precisely *because* they do not
> use the FPU - they use the integer unit, which was not made for
> mul/div's.

Ok, what he did not say is this is the case on a Pentium, which is true.
On a 486 or lower, an integer multiply/divide will be faster than
floating point.  I don't know what you mean by "was not made for
mul/div's".  All x86 CPUs have a hardware multiplier (unlike the 6502,
older versions of SPARC, and others), so I'm not sure what you're trying
to say here.

-- 
"With a touch more confidence and a liberal helping of ignorance I would have 
been a famous evangelist."
                        -- Stranger In A Strange Land
PLENTY of ignorance at http://www.cs.pdx.edu/~idr

- Raw text -


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