' ******************************************************************
' Minimum and maximum
' ******************************************************************

FUNCTION IMax(X AS INTEGER, Y AS INTEGER) AS INTEGER
  IF X > Y THEN IMax = X ELSE IMax = Y
END FUNCTION

FUNCTION IMin(X AS INTEGER, Y AS INTEGER) AS INTEGER
  IF X < Y THEN IMin = X ELSE IMin = Y
END FUNCTION

FUNCTION Max(X AS DOUBLE, Y AS DOUBLE) AS DOUBLE
  IF X > Y THEN Max = X ELSE Max = Y
END FUNCTION

FUNCTION Min(X AS DOUBLE, Y AS DOUBLE) AS DOUBLE
  IF X < Y THEN Min = X ELSE Min = Y
END FUNCTION
