Mail Archives: djgpp/1999/10/01/19:32:53
On Fri, 1 Oct 1999 16:20:23 -0400 (EDT), Daniel Reed
<djr AT narnia DOT n DOT ml DOT org> wrote:
>On Fri, 1 Oct 1999, Kevin wrote:
>) On Thu, 30 Sep 1999 00:57:43 -0700, Clemens Valens
>) <c DOT valensNOc DOT SPAM AT mindless DOT com DOT invalid> wrote:
>) >See allegro.h. There MID() is defined as follows:
>) >#define MID(x,y,z) MAX((x), MIN((y), (z)))
>) I think I see now, it returns whichever of x, y or z is the middle
>) value.
>Maybe that's what it's supposed to do, but if you were to pass 3,2,1 to that
>macro, it'd evaluate as follows:
> MAX(3, MIN(2, 1))
> MAX(3, 1)
> 3
>
>Passing 1,2,3 or 2,3,1 work as expected, it's just if the first argument is
>the largest it will be returned instead of the middle argument.
Shawn himself (we're not worthy, we're not worthy) has cleared this up
in a later posting and sais words to the effect of
using MID(x, y, z)
x should be less than z.
if y is less than x, x will be returned
if y is greater than z, z will be returned.
if y > x and y < z, y will be returned.
it limits the range of values reeturned to between x and z
at least that's my understanding of it.
Kevin.
Thankyou Shawn.
- Raw text -