Path: utzoo!utgpu!watmath!clyde!att!rutgers!tut.cis.ohio-state.edu!unmvax!ncar!tank!nic.MR.NET!shamash!nis!ems!amdahl!uunet!auspex!guy
From: guy@auspex.UUCP (Guy Harris)
Newsgroups: comp.arch
Subject: Re: Assembly or .... (two-result functions)
Keywords: remainder 80x87
Message-ID: <587@auspex.UUCP>
Date: 6 Dec 88 06:51:21 GMT
References: <1388@aucs.UUCP| <729@convex.UUCP> <1961@crete.cs.glasgow.ac.uk> <6089@eagle.ukc.ac.uk> <1047@l.cc.purdue.edu>
Reply-To: guy@auspex.UUCP (Guy Harris)
Organization: Auspex Systems, Santa Clara
Lines: 25

>I did not know of the 80387 instruction.  But how will programmers use it?
>The languages still do not allow
>
>	x, y = fsincos(z);

Yes, but they allow

	X = SIN(Z)
	Y = COS(Z)

and I think there are FORTRAN compilers (hence the CAPITAL LETTERS :-))
that will make a single call to the "sin/cos" function, or generate a
single "sin/cos" instruction, and store the two results into X and Y. 
This could conceivably be done with C as well; consider:

math.h:

	#define	sin(x)		_builtin_sin(x)
	#define	cos(x)		_builtin_cos(x)

and a compiler that knows about "_builtin_sin" and "_builtin_cos".

There's no particular need, in general, for programming language
constructs to directly match hardware constructs in order for the
hardware constructs to be used....