Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!ittvax!dcdwest!sdcsvax!sdcrdcf!hplabs!sri-unix!jrv@mitre-bedford.ARPA From: jrv@mitre-bedford.ARPA Newsgroups: net.lang.c Subject: New operator: /* Message-ID: <12856@sri-arpa.UUCP> Date: Sun, 26-Aug-84 18:56:00 EDT Article-I.D.: sri-arpa.12856 Posted: Sun Aug 26 18:56:00 1984 Date-Received: Thu, 30-Aug-84 19:44:00 EDT Lines: 24 I was using a FORTH (pardon the profanity) the other day and found a neat new operator: /*. It has the effect of multiplying two integers, then dividing by a third WITH A DOUBLE LENGTH INTERMEDIATE, so it won't overflow unless the final result does. It's handy when floating point operations are unavailable or too slow (such as in graphics). Most machines with multiplication give a double length result, and most with division can start with a double length dividend. However, C doesn't presently give us access to these operations. My question: what's a reasonable C syntax for it? The obvious one is a/b*c, but it's already spoken for. Are there compilers that let you get this effect by explicitly declaring the intermediate: short a,b,c,d; long temp; ... temp=a*b; d=temp/c; Of course, you can define this as a a function in assembly language, but the calling overhead would reduce the speed advantage. Any thoughts would be welcome. - Jim Van Zandt