Typecast DOUBLE(expression)

Top  Previous  Next

The DOUBLE typecast operator is used to convert an expression to a DOUBLE type. This typecast is done numerically so that for example typecasting an integer value of 56 will yield a floating-point value of equally 56.0.

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  a : DINT;
  f : DOUBLE;
END_VAR;
 
PROGRAM test;
 
// Convert 'a' which is a DINT type to a DOUBLE
a := 4711; // Integer value to convert.

f := DOUBLE(a); // f will now contain 4711.00
 
END_PROGRAM;