X++ operators div and mod in CIL can cast their operands differently and return result of different base types compared to X++ interpreter. Consider these examples:
Tested in AX 2012 R2 with kernel builds 6.2.1000.4051 (CU7) and 6.2.1000.8310.
Test operation | X++ results | CIL results | ||
0 div 2 | Integer | 0 | Int64 | 0 |
intMax() div 2 | Integer | 1073741823 | Int64 | 1073741823 |
realMax() div 2 | Integer | 1073741823 | Int64 | 4999999999999999 |
int64Max() div 2 | Int64 | 4611686018427387903 | Int64 | 4611686018427387903 |
intMax() mod 2 | Integer | 1 | Integer | 1 |
realMax() mod 2 | Integer | 1 | Real | 1,00 |
int64Max() mod 2 | Int64 | 1 | Int64 | 1 |
Tested in AX 2012 R2 with kernel builds 6.2.1000.4051 (CU7) and 6.2.1000.8310.