Typecast SINT(expression)

Top  Previous  Next

The SINT typecast operator is used to convert an expression to a SINT type. If the typecast operator is used on a "larger" type, truncation will occur.

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  a : INT;
  b : SINT;
END_VAR;
 
PROGRAM test;
 
BEGIN
  // Convert 'a' which is a INT type to a SINT (truncation will occur)
  b := SINT(a);
  ...
END;
 
END_PROGRAM;