Floating Point Arithmetic

Sean Fagan seanf at sco.COM
Fri Nov 16 10:28:28 AEST 1990


In article <14366 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>In article <27095.9010261638 at olympus.cs.hull.ac.uk> rst at cs.hull.ac.uk (Rob Turner) writes:
>><henry at zoo.toronto.edu> (Henry Spencer) writes:
>> >In general, you should use 'double' for all floating point arithmetic
>>I agree with this, although it took me a fair while to get over the
>>natural hurdle of always prefering to use float because float
>>arithmetic 'must be faster' than double.
>Interestingly, that is not always true, especially using IEEE FP chips.

One of the more amusing tests I've run was on an AT&T 3B5, with no FPU (it
did, however, have an FP emulator).  Anyway, code using 'float' was *much*
slower than code using 'double', because all 'float' variables had to be
promoted to 'double', and that was *also* emulated, and took quite a bit of
time (not to mention demoting them back down to 'float').

-- 
-----------------+
Sean Eric Fagan  | "*Never* knock on Death's door:  ring the bell and 
seanf at sco.COM    |   run away!  Death hates that!"
uunet!sco!seanf  |     -- Dr. Mike Stratford (Matt Frewer, "Doctor, Doctor")
(408) 458-1422   | Any opinions expressed are my own, not my employers'.



More information about the Comp.lang.c mailing list