Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rochester.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!rochester!quiroz From: quiroz@rochester.UUCP (Cesar Quiroz) Newsgroups: net.lang.c Subject: Re: C language hacking Message-ID: <3323@rochester.UUCP> Date: Mon, 12-Nov-84 10:10:53 EST Article-I.D.: rocheste.3323 Posted: Mon Nov 12 10:10:53 1984 Date-Received: Tue, 13-Nov-84 01:32:44 EST References: <5715@brl-tgr.ARPA> Distribution: net Organization: U. of Rochester, CS Dept. Lines: 30 >(from a recent posting :) > I find that frequently I need both the quotient and remainder of > two integers: a / b a % b > Since most (maybe all) machine architectures compute these at the > same time, it sure would be nice to be able to get both results > rather than wastefully reexecuting precisely the same instructions > a second time. This becomes particularly bothersome when "a" & "b" > are fairly complicated expressions. I have no idea what a good > syntax for such an operation would be. > > It would also be nice if sin( x ) and cos( x ) could be computed > simultaneously with reduced cost. I doubt if this is possible > but would like to know if it is. Both are reasonable expectations, but seem to have a place in a standard library rather than in the syntax of the language. The sin/cos simultaneous computing is something you can program in C completely. Getting both quotient and remainder at the same time cannot (at least not without incurring a procedure call, which denies the advantage) and you may have a point if you expect the compiler to recognize something like: intdiv(a,b,&q,&r); and expand it in line. However, it may be too much additional overhead for the gains. In such a case, you may feel forced to write assem... (no I didn't mean to type that!). Cesar