Float Double Parameters

Doug Gwyn gwyn at brl-smoke.ARPA
Mon Apr 14 05:24:40 AEST 1986


Herndon correctly attributes C's "double-precision only"
design to PDP-11 FP11 characteristics (although I think
it was also felt that single-precision had too few bits
to be very useful anyway), but he is mistaken in many of
the details.

The kernel could both read and write the status register;
6th Edition UNIX as distributed did not properly handle
asynchronous FP11s, although it did make an attempt to
save and restore FP11 state during user process context
switching.  (Note that the FP11 needed to be put into
double mode during register save/restore.)  One of the
things I did to the kernel at Geotronics was to fix FP11
handling and install it in the non-I&D version; it wasn't
very difficult.

Allowing both single- and double-precision operation would
certainly complicate the code generator, since the FP11
used a "mode" setting rather than separate instructions.
Thus, a SETD at the beginning of the code would suffice
to lock in double-precision operation; it also would cause
a trap on a non-FP11 machine, so there were special
arrangements to ignore the trap.

The current conception is to permit either the double-only
implementation of C or allow support for single-precision
in expressions at the implementor's discretion.



More information about the Comp.lang.c mailing list