RTOI – Real to integer number conversion

Block SymbolLicensing group: STANDARD
PIC

Function Description
The RTOI block converts the real number r to a signed integer number i. The resulting rounded value is defined by:

i = 2147483648, for r 2147483648.0, round(r), for 2147483648.0 < r 2147483647.0, 2147483647, for r > 2147483647.0,

where round(r) stands for rounding to the nearest integer number. The number of the form n+0.5 (n is integer) is rounded to the integer number with the higher absolute value, i.e. round(1.5) = 2, round(2.5) = 3.

Note that the numbers 2147483648 and 2147483647 correspond with the lowest and the highest signed number representable in 32-bit format respectively (0x7FFFFFFF and 0x80000000 in hexadecimal form in the C language). This limits are valid if the vtype parameter has default value.

This block propagates the signal quality. More information can be found in the 1.4 section.

Input

r

Analog input of the block

Double (F64)

Parameter

vtype

Numeric type  4

Long (I32)

2 ....

Byte (U8)

3 ....

Short (I16)

4 ....

Long (I32)

5 ....

Word (U16)

6 ....

DWord (U32)

10 ...

Large (I64)

SAT

Saturation (overflow) checking  on

Bool

off ..

Overflow is not checked

on ...

Overflow is checked

Output

i

Rounded and converted input signal

Long (I32)

2024 © REX Controls s.r.o., www.rexygen.com