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).

Input

r

Analog input of the block

double

Output

i

Rounded and converted input signal

long

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