[comp.arch] single vs double float

chris@mimsy.UUCP (Chris Torek) (02/02/88)

In article <408@micropen> dave@micropen (David F. Carlson) writes:
>It is the case (K&R p184) that "All floating arithmetic in C is carried
>out in double-precision;" regardless whether declared as single precision
>or not.

Note, however, that at least two `well-known' C compilers, namely
those in SunOS (>= 3.0 at least) and 4.3BSD, have options to do
floating arithmetic in single precision if all operands are single
precision.  Use `cc -fsingle' (SunOS) or `cc -f' to trigger this.
Moreover, the current X3J11 draft C standard permits this behaviour.

(Personally, I think new architectures should make single precision
64 bits and double precision 128 bits....)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

abh@POGO.CAMELOT.CS.CMU.EDU (Andrew Hastings) (02/03/88)

In article <10420@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes:
> (Personally, I think new architectures should make single precision
> 64 bits and double precision 128 bits....)

CRAY computers have had 64 bit single precision since their introduction
in 1976.  The CRAY C compiler treats `double' as `float' (i.e., floating
arithmetic is performed in single precision) since double precision is
about an order of magnitude slower than single precision on these machines.

-Andrew Hastings		abh@cs.cmu.edu			412/268-8734

rpeglar@como.lake.eta.com (Rob Peglar) (02/08/88)

In article <790@PT.CS.CMU.EDU> abh@POGO.CAMELOT.CS.CMU.EDU (Andrew Hastings) writes:
>In article <10420@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes:
>in 1976.  The CRAY C compiler treats `double' as `float' (i.e., floating
>arithmetic is performed in single precision) since double precision is
>about an order of magnitude slower than single precision on these machines.
>an order of magnitude slower.
>
>-Andrew Hastings		abh@cs.cmu.edu			412/268-8734

You're right.

The CDC Star-100 series of the late 60's/early '70s also had 64-bit single
precision.  Due to the VERY large instruction set, they also could do double
precision (128-bit results) at a ratio of 5 or 6:1 versus single.  That  
figure just counts the cycles involved in the add lower/upper, normalize,
etc etc instructions used to do double precision.

BTW, ETA C also treats 'double' as 'float'.


Rob Peglar

The above is my opinion, not that of my employer.  (the usual)