Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Min/Max Problems? (http://www.chiefdelphi.com/forums/showthread.php?t=18042)

AndyKK2 16-02-2003 15:11

Min/Max Problems?
 
After days of staring blankly at four lines of seemingly flawless yet obviously disfunctional code, we discovered that the problem was in our MIN and MAX functions. Turns out MIN gives the max and MAX gives the min? Has anyone else had problems with this? Maybe that makes sense to some people, but doesn't it seem a bit backwards?

Anthony Kesich 16-02-2003 20:23

...?
 
umm... if thats hapening, then there is something wrong with your compiler or code. Why don't you post some of the faulty/questionable code so i can look it over?

-Kesich

Ameya 16-02-2003 21:12

Yeah, it seems kind of odd that MIN returns the maximum of the arguments while MAX returns the minimum, but it makes sense if you think about it in another way:

MIN sets the minimum allowable value of an expression to another value.

MAX sets the maximum allowable value of an expression to another value.

So if you do
a = a + 1 MAX 127
then a will increment, but will never go higher than 127.

Hope that helps you understand.


All times are GMT -5. The time now is 04:27.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi