If you want to know if a number is odd or even, you can do the following now:
IF #I <> #I / 2 * 2 THEN ... END-IF
This takes however quite a bit of CPU, but it can already by simplified by following declarations:
1 #I (I4)
1 REDEFINE #I
2 FILLER 3X
2 #I_ODD (L)
The test can then be written as:
IF #I_ODD THEN ... END-IF
Because internally there is being tested on the rightmost bit.
This is easy for integers, it is just a TM (test under mask). And for packed and float numbers, a test on the rightmost bit of INT(number) should be made.
This idea should be valid for all platforms, like the similar function in PASCAL and its derivates.
Use Case | See example in description |