Numerical C
Doug Gwyn
gwyn at brl-vgr.ARPA
Wed May 2 08:18:49 AEST 1984
I think all three answers (as to why floats are promoted to doubles in C)
are applicable, with the amendment that the PDP-11 floating-point
processors (FP11s) do not necessarily work in double-precision, but
one has to change their mode back and forth to change from double-
precision to single-precision arithmetic, so it was simpler to just
leave the mode in double-precision all the time (code starts with a
SETD instruction to do this).
PDP-11 floating-point has never been really satisfactory anyway. It is
very hard (but not impossible) to share the FP11 coprocessor among
multiple processes; early UNIXes did not properly save & restore the
FP11 status upon context switch due to the ansynchronism of the beast.
Whoever first introduced 32-bit integers along with the FP11 really
botched the job, and these weren't straightened out until the VAX
(which is otherwise binary data compatible with the PDP-11).
I rather like having all my arithmetic done in double-precision, though.
VAX & PDP-11 single-precision isn't good for much serious computation.
More information about the Comp.lang.c
mailing list