Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!zehntel!hplabs!sri-unix!buck@NRL-CSS.ARPA
From: buck@NRL-CSS.ARPA
Newsgroups: net.unix-wizards
Subject: Re:  floats and doubles on a VAX 750 with an FPA
Message-ID: <714@sri-arpa.UUCP>
Date: Fri, 3-Aug-84 13:38:12 EDT
Article-I.D.: sri-arpa.714
Posted: Fri Aug  3 13:38:12 1984
Date-Received: Mon, 6-Aug-84 00:51:58 EDT
Lines: 28

From:  Joe Buck 

	Recently I ran some tests to calculate the cost of the phrase
	"all floating arithmetic in C is carried out in double-precision..."
	(K&R pp 184 section 6.2 -- to quote chapter and verse).  It turned
	out to be really expensive.  For instance, the code generated by
	the C compiler to evaluate "a *= b"
	
		cvtfd	-12(fp),r0
		muld2	r0,-20(fp)
		cvtdf	-20(fp),-12(fp)
	
	turned out to be four times as expensive as the equivalent
	floating point operation
	
		mulf2	-20(fp),-12(fp)
	
If memory is not a problem, you could declare some or all of the variables
double and get rid of the cvt's, before going to a lot of trouble to convert
the assembler output, or to modify the code. Since I don't see any reason
why a muld2 should cost more than twice a mulf2, this should double the
speed.

I understand that the new ANSI standard will allow single precision
computation, but it's not clear whether support for this would be
required or optional.

-Joe