Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: The need for D-scussion (was Re: D Wishlist) Message-ID: <1988Mar14.193831.558@utzoo.uucp> Organization: U of Toronto Zoology References: <12176@brl-adm.ARPA> <1988Mar11.215238.976@utzoo.uucp>, <3732@bloom-beacon.MIT.EDU> Date: Mon, 14 Mar 88 19:38:31 GMT > a function the returns both a % b and a / b at the same time. ANSI has beaten you to it. See section 4.10.6.2 in the current X3J11 draft, which defines the "div" function, returning a struct containing both quotient and remainder. (They chose the wrong definition of division, but I suppose one can't have everything...) This is probably the best approach to the issue, since not all machines do in fact efficiently compute both in the same operation. (The VAX, for example, has fast instructions that give you either, and a [reportedly] rather slow instruction that gives you both.) Better to supply both only when asked. -- Those who do not understand Unix are | Henry Spencer @ U of Toronto Zoology condemned to reinvent it, poorly. | {allegra,ihnp4,decvax,utai}!utzoo!henry