Currently the LogicLab compiles the comparisons considering the constants as a DWORD (32 bits), so without any type declaration only the first 32 bits of the LWORD variable are compared, please refer to the following example.
VAR
MyLW : LWORD;
MyResult : ARRAY[0..3] OF BOOL;
END_VAR
// TRUE IF MyLW=16#0000000000000000
// TRUE IF MyLW=16#0000000100000000
// FALSE IF MyLW=16#0000000010000000
MyResult[1]:=TO_BOOL(MyLW = 0);
// FALSE IF MyLW=16#0000000000000000
// FALSE IF MyLW=16#0000000100000000
// TRUE IF MyLW=16#0000000010000000
MyResult[0]:=TO_BOOL(MyLW <> 0);
// TRUE IF MyLW=16#0000000000000000
// TRUE IF MyLW=16#0000000100000000
// TRUE IF MyLW=16#0000000010000000
MyResult[3]:=TO_BOOL(MyLW = LWORD#0);
// FALSE IF MyLW=16#0000000000000000
// TRUE IF MyLW=16#0000000100000000
// TRUE IF MyLW=16#0000000010000000
MyResult[2]:=TO_BOOL(MyLW <> LWORD#0);
// [End of file]
As you can see in the example to obtain correct result L’WORD# must precede the constant declaration. I will ask to Axel if in the future some modifications will be done.