GX Works3 - Function block for rounding float numbers with variable amount of significant numbers

GX Works3 - Function block for rounding float numbers with variable amount of significant numbers

This article contains GX Works3 function block for rounding float numbers with variable amount of significant numbers.

"Copyright © Mitsubishi Electric Europe B.V.

IMPORTANT !

These Function Blocks are demo versions that are only  intended to demonstrate program functions and provide general orientation for  your software choices. They are not suitable for use in real applications! "

 "Improper use of demo versions in applications can lead to serious malfunctions  and damage! Programs for real applications must always be configured for the  individual application by trained staff and tested thoroughly before being  used.

 Mitsubishi Electric cannot assume any liability if these examples are used in real applications."


This function block return rounded FLOAT number, rounded with mathematical convention of rounding numbers. Selecting amount of significant numbers is possible using second input.

Input/Output

Data Type

Description

i_eNumber

FLOAT

Number to be rounded

i_iSignificantNum

Word [Signed]

Amount of significant numbers

EROUND

FLOAT

Rounded number


 

Selecting amount of numbers after the dot is possible using i_iSignificantNum input. When „0” is inputted, number will be rounded to integer part:

6.3864 -> 6.0000

When i_iSignificantNum is set to another number, for example „2”:

6.3864 -> 6.3900