Typecast FLOATB(expression)

Top  Previous  Next

The FLOATB typecast operator is used to convert an expression to a FLOAT type. This typecast is done binary instead of numerically, making the FLOAT the raw value of the expression.

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  a : DINT;
  f : FLOAT;
END_VAR;
 
PROGRAM test;
 
// Convert 'a' which is a DINT type to a FLOAT
a := 16#7F800000; // Positive Infinity in IEEE 754 single precision

f := FLOATB(a); // Infinity
 
END_PROGRAM;