# LGF_RoundByPrecision (FC / 1.0.0)

Overview

Author: Siemens Digital Industry

## Short description

This function rounds a floating-point number (LReal) to a specified number of decimal places.

### Block Interface

| LGF_RoundByPrecision (FC) |
--- | --- | ---
LReal |  |  | number |  | Ret_Val |  |  | LReal
UInt |  |  | precisionDecimal |  |  |  |  |

### Input parameter

Identifier | Data type | Description
--- | --- | ---
number | LReal | Value to be rounded
precisionDecimal | UInt | Number of decimal places to round the number (1,2,3)

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | LReal | Number rounded with the number of decimal places selected

## Functional description

This function rounds a floating-point number (LReal) to a specified number of decimal places.
It scales the value, truncates it to an integer, and then re-scales it to produce the rounded result.

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | Siemens Industry Online Support
| 30.07.2025 | First released version