[net.unix-wizards] please fix floating point in the c compilers!

dove.mit-dspg@Mit-Mc@sri-unix (09/05/82)

Date: 2 Sep 1982 12:57:19-EDT
yes Yes YES!!!

mark (09/08/82)

I quote from page 184 of the C book (section 6.2 of the C reference
manual):

"All floating arithmetic in C is carried out in double-precision;
whenever a float appears in an experssion it is lengthened to double
by zero-padding its fraction."

Thus, any "fix" to the C compilers that cause single precision arithmetic
to be carried out using single precision instructions would be a
violation of the language, unless it could be shown that the results
would be identical.

I will not attempt to defend this, since I rarely use floating point
I don't care one way or the other.  But this property has been with
the language since day one and is unlikely to change in the near future.

Note that a similar thing happens with char/short/int - everything is
widened to int before anything is done.  Nobody seems to mind this,
although if everything were widened to long on an 11 I suspect people would.

obrien@Rand-Unix@sri-unix (09/15/82)

Date: Monday, 13 Sep 1982 10:44-PDT
Changes in the results of numerical calculations as a result of
changing the way float and double work might, in fact, be pretty minor
compared to the possibility of errors in the math routines.  A recent
Science News article points out that the math libraries on many machines
(and calculators) are grossly in error.

	There's a professor at Berkeley busy rewriting the C library math
functions to conform to the IEEE standard.