C Floating point arithmetic

Daniel R. Levy levy at ttrdc.UUCP
Fri Nov 22 11:55:27 AEST 1985


In article <286 at well.UUCP>, farren at well.UUCP (Mike Farren) writes:
>In article <3369 at brl-tgr.ARPA>, Schauble at mit-multics.arpa (Paul Schauble) writes:
>> Does anyone know of a C compiler for the IBM PC that does NOT force all
>> floating point arithmetic to be done in double precision? 8087 support
>> is necessary.
>    Yes, but the 8087 forces conversion to double-precision anyway, there
>is no way to avoid it. Why would you want to?

One would wish to do this for the same reason that floats and doubles are
two distinct types in Fortran (real and double precision)--sometimes the
added machine-crunch effort to handle the doubles is unnecessary for the
amount of precision desired out of the computation.   If the machine has
separate floating point instructions meant to handle the smaller floats,
this makes sense, but if (as in the case of the 8087) it only handles
double-size items, I agree it is pointless (alas) to make the distinction
except artificially.  On machines that do provide distinct instructions
for floats and doubles, a multiply/divide of two doubles takes ~4 times
the crunch of a multiply of two floats as best as I can remember from CS101.
(Refutations tolerated, flames > /dev/null).
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!ihnp4!ttrdc!levy



More information about the Comp.lang.c mailing list