MinMaxVector

Declaration: MinMaxVector (Data: TDoubleArray; First, Last: integer; var min, max: double; var MinIdx, MaxIdx: integer): integer;
Calculates the minimum and the maximum of the data contained in the array Data, using all values from First to Last (the array Data has 0-based indices). If First is greater than Last then First and Last are automatically exchanged.

The function returns the following error codes:

 0 ... everything is OK
-1 ... First and/or Last are out of range