# Truncation

Help Contents
- Fernhill SCADA
- Help
- IEC 61131-3
- Common Elements
- Functions
- Conversion Functions
- Truncation

## Introduction

The **Truncation** functions convert real values to integers by rounding to the next integer closest to zero.

You can declare truncation in three different ways:

Form | Syntax | Description |

Exactly Typed | *_TRUNC_** |
Where * is the type to change from, and ** is the type to change to.
For example: REAL_TRUNC_INT( 12.5 ) |

Overloaded #1 | ANY_TRUNC_** |
Where ** is the type to change to.
For example: ANY_TRUNC_INT( 12.5 ) |

Overloaded #2 | TRUNC_** |
Where ** is the type to change to.
For example: TRUNC_INT( 12.5 ) |

The **from** (*) type can be **REAL** or **LREAL**.
The **to** (**) type can be **SINT**, **USINT**, **INT**, **UINT**, **DINT**, **UDINT**, **LINT**, or **ULINT**.

Examples of floating point rounding using REAL_TRUNC_INT( X ):

Floating Point | Rounded Integer Result |

REAL#3.6 | INT#3 |

REAL#3.5 | INT#3 |

REAL#3.4 | INT#3 |

REAL#2.5 | INT#2 |

REAL#1.5 | INT#1 |

REAL#-1.5 | INT#-1 |

REAL#-2.5 | INT#-2 |

REAL#-3.4 | INT#-3 |

## Standards Compliance

IEC 61131-3 Second Edition: Table 22.2.

IEC 61131-3 Third Edition: Table 22.2.

## Further Information

Elementary Data Type
To learn about the standard elementary data types.

Type Casts
To learn about other methods of converting from real numbers to integers.

Conversion Functions

For a summary of all conversion functions.

Common Elements

To learn about other common language elements.

Glossary

For the meaning of terms used in **Fernhill SCADA**.