# LGF_SearchMinMax_LReal (FC / 3.0.2)

Overview

Author: Siemens Digital Industries

## Short description

This function searches, in an array of the data type LReal, for the maximum and minimum value and the respective index in the array.

### Block Interface

| LGF_SearchMinMax_LReal (FC) |
--- | --- | ---
|  |  |  |  | Ret_Val |  |  | Void
|  |  |  |  | minValue |  |  | LReal
|  |  |  |  | minValueIndex |  |  | DInt
|  |  |  |  | maxValue |  |  | LReal
|  |  |  |  | maxValueIndex |  |  | DInt
Array[*] of LReal |  |  | values |  |  | Array[*] of LReal

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | Void | Void - Function has no return value
minValue | LReal | Minimum value found in the array
minValueIndex | DInt | Index of the minimum found value in the array. The start index of the array plus `minValueIndex` results in the array index of the smallest value. The index starts with 0.
maxValue | LReal | Maximum value found in the array
maxValueIndex | DInt | Index of the maximum found value in the array. The start index of the array plus `maxValueIndex` results in the array index of the smallest value. The index starts with 0.

### In/Out parameter

Identifier | Data type | Description
--- | --- | ---
values | Array[*] of LReal | Array in whose fields the maximum and minimum are searched

## Functional description

An array of any size is connected via the `values` input. The elements are then compared in turn. The smallest and largest values, as well as their corresponding index are output to the array.

Note
  If there are several identical min. or max. values, the index of the first min. or max. value is output.

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | Simatic Systems Support
| 11.11.2019 | First release copied from "LGF_SearchMinMax" and reworked to array[*]
| 3.0.0 | Simatic Systems Support
| 23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library
| 3.0.1 | Simatic Systems Support
| 09.02.2021 | Insert documentation
| 3.0.2 | Simatic Systems Support
| 14.11.2022 | Fix loop start index (start from lower Bound + 1)