attologix
Member
I'm writing some structured text that's handling a data structure that comes from a PC. The PC structure is in the "new" LREAL 64-bit floating point format (new to Rockwell as of V32 from 2019, new to computing as of the Intel 8087 math coprocessor from 1985...). But I digress.
Most operations are working fine:
But I can't write more complicated CPT expressions:
because it complains:
Is there a workaround for this limitation? I'm familiar with the 16# and 0b prefixes for hex and binary numeric literals, is there one (eg. the C language 'f' or 'l' for 32- or 64-bit float or long types) that says "treat the 2 as an LREAL"?
Edit: On further testing, it's not the 2.0, it's the combination of subtraction and multiplication on one line. You can combine addition and subtraction, or multiplication and division, but with or without parentheses Rockwell can't add and multiply in a single expression. I can work around it by breaking it to two lines:
but this gets really tedious for longer expressions.
Most operations are working fine:
Code:
// Can assign one LREAL to another
Current_CY := Centroids[0].Y;
// Can assign a literal to an LREAL
Previous_Left := 10.0;
// Can perform and assign an ADD/SUB/MUL/DIV equivalent
Panos[i].Width := FarRight[i].Y - NearLeft[i].Y;
But I can't write more complicated CPT expressions:
Code:
Panos[i].Width := (Centroids[i].Y - Previous_Left) * 2.0;
because it complains:
Error: (Pend), Line ##: Extended datatypes (USINT, UINT, UDINT, LINT, ULINT, LREAL) are not supported in expression.
Is there a workaround for this limitation? I'm familiar with the 16# and 0b prefixes for hex and binary numeric literals, is there one (eg. the C language 'f' or 'l' for 32- or 64-bit float or long types) that says "treat the 2 as an LREAL"?
Edit: On further testing, it's not the 2.0, it's the combination of subtraction and multiplication on one line. You can combine addition and subtraction, or multiplication and division, but with or without parentheses Rockwell can't add and multiply in a single expression. I can work around it by breaking it to two lines:
Code:
Panos[i].Width := (Centroids[i].Y - Previous_Left);
Panos[i].Width := Panos[i].Width * 2;
but this gets really tedious for longer expressions.