From: DavMac AT iname DOT com (Davin McCall) Newsgroups: comp.os.msdos.djgpp Subject: Re: What is MID() macro ? Date: Fri, 01 Oct 1999 06:09:51 GMT Organization: Monash Uni Lines: 28 Distribution: world Message-ID: <37f44f86.8922282@newsserver.cc.monash.edu.au> References: <%jHI3.30026$ei1 DOT 52479 AT newsfeeds DOT bigpond DOT com> NNTP-Posting-Host: damcc5.halls.monash.edu.au X-Trace: towncrier.cc.monash.edu.au 938758185 12444 130.194.198.138 (1 Oct 1999 06:09:45 GMT) X-Complaints-To: abuse AT monash DOT edu DOT au NNTP-Posting-Date: 1 Oct 1999 06:09:45 GMT X-Newsreader: Forte Free Agent 1.1/32.230 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Thu, 30 Sep 1999 11:36:33 +1000, "Johan Venter" wrote: >From allegro.h: > >#define MIN(x,y) (((x) < (y)) ? (x) : (y)) >#define MAX(x,y) (((x) > (y)) ? (x) : (y)) >#define MID(x,y,z) MAX((x), MIN((y), (z))) > >From my understanding of that, it finds the middle number of the three passed to >it. Surely, if 'x' is the greatest value, this won't work.. eg: MID(10,9,8) expands to: MAX(10, MIN(9,8)) which is equivalent to: MAX(10,8) which is clearly 10. Am I doing something wrong here? Davin. __________________________________________________________ *** davmac - sharkin'!! davmac AT iname DOT com *** my programming page: http://yoyo.cc.monash.edu.au/~davmac/