Re: Minimum & Maximum
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Sep 25, 1998
- 530 views
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 >