Re: Minimum & Maximum

new topic     » goto parent     » topic index » view thread      » older message » newer message

Carl,

I think you have to include <= and >= comparisons respectively in your
functions, as it is done in Mike's. Your functions return zeros for equal
elements. jiri


-----Original Message-----
From: Carl R. White <C.R.White at SCM.BRAD.AC.UK>
To: EUPHORIA at cwisserver1.mcs.muohio.edu
<EUPHORIA at cwisserver1.mcs.muohio.edu>
Date: Friday, September 25, 1998 9:30 PM
Subject: Re: Minimum & Maximum


>On Thu, 24 Sep 1998, Noah Smith wrote:
>
>> function minimum(object a, object b)
>>     object c
>>
>>     c = repeat(length(a), 0)
>>     for i = 1 to length(a) do
>>         if a[i] > b[i] then
>>             c[i] = b[i]
>>         else
>>             c[i] = a[i]
>>         end if
>>     end for
>>     return c
>> end function
>
>function minimum(object a, object b)
>    return a * (a<b) + b * (b<a)
>end function
>
>function maximum(object a, object b)
>    return a * (a>b) + b * (b>a)
>end function
>
>I'm at it again :)
>
>--
>Carl R White
>E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
>Url......: http://www.bigfoot.com/~cyrek/
>"Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr." - B.Q.Vgesa
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu