C Floating point arithmetic

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Fri Nov 29 18:28:11 AEST 1985


> >I am in favor of supporting low-precision floating point in
> >C, as permitted by X3J11, but let's not make it the default.
> 
> This argument is hard to swallow. You are suggesting protection
> for the user by not giving him what he has asked for in his
> code.

That was NOT what I said.  "I am in favor of supporting
low-precision floating-point in C, as permitted by X3J11."

This means that the compiler is free to evaluate
	(float) op (float)
in single-precision if the implementer decides to do so.
The implementer may choose instead to continue to coerce
(float)s to (double)s in expressions.  Presumably most C
implementations, especially those on number crunchers,
would support single-precision operations.

For compatibility reasons, if none other, it is essential
to maintain (double)-ness for floating-point constants etc.
One can obtain single-precision by something like
	(float)1.0
if so inclined.



More information about the Comp.lang.c mailing list