C Floating point arithmetic

zben at umd5.UUCP zben at umd5.UUCP
Mon Nov 25 22:04:42 AEST 1985


In article <4614 at alice.UUCP> ark at alice.UucP (Andrew Koenig) writes:

These comments by garry wiegand:   [z]

>> In an inauspicious moment, K&R specified "All floating-point arithmetic
>> in C is done in double precision" (pg 41).
>>	1) floats, as opposed to doubles, are costly and useless (except 
>>	   when memory space is critical), and
>>	2) I have to advise people with CPU-intense problems not to use C.
>> Comments? Does everybody agree?
 
Andrew replies:    [z]

>No -- on most machines, single-precision does not offer enough significance
>for serious number-crunching, so people tend to use double-precision
>anyway if they care about the results.

Now, this is a most disingenious argument.  If this were really true, one
would map 'float' to the double-precision operations and totally ignore the
single-precision ones.

Let's face it - this, as well as several other "features" of the Unix system
(such as the treatment of parameters passed to functions) is left over from
the PDP-11 days, and puts the lie to Unix's claim of machine independance...

Well, perhaps that's too strong.  A better statement is that like every other
claim made by Unix, the claim of machine independance is only about 90% true.

Don't get sore!  90% is pretty damn good given the level of snake oil in 
this field...
-- 
Ben Cranston  ...{seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben  zben at umd2.ARPA



More information about the Comp.lang.c mailing list