#### Issue

Bug in conversion of real numbers to integers in Menta Expression Blocks

#### Product Line

TAC Vista

#### Environment

TAC Xenta 280/300/401 with system program version up to version 3.41

#### Cause

A bug exists that causes real numbers to be improperly converted to integers in Expression Blocks. The issue is that some functions that return a real result (e.g. +-*/ and exponentiation) will sometimes return a value slightly less than expected.

For example, 2**5, which is 2 to the fifth power, should return 32. Instead, 31.9999999999 is returned. In an expression that then then converts this to an integer (e.g. "A&(2**5)"), the result gets truncated to 31 instead of the expected 32. In the example "A&(2**5)", A will then be bitwise AND-ed with binary 01111 instead of 10000.

Unfortunately, this bug is only seen when running the code live on a controller. In offline simulation mode, 2**5 returns the correct value of 32, which only makes the bug more difficult to diagnose. Oddly, The XPI block and the INT() function convert results to integers differently. An XPI block with expression "2**5" will return 32. However, and XPI block with expression "INT(2**5)" will return 31. In some cases (e.g. 19**3) both the XPI block and the INT() function return the incorrectly truncated value.

This behavior is corrected from version 3.50 of TAC Xenta 280/300/401

#### Resolution

The work-around is to never use operations that return real values in an expression that also does operations that convert the operands to integers (such as bitwise operations).

This behavior is corrected from version 3.50 of TAC Xenta 280/300/401