INT64 in arithmetic and comparison operations
- Last Updated: January 16, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Arithmetic operations are unchanged by the new INT64 data
type. That is, operators (such as the * Multiplication and the +
Addition operators) are still compiled as INTEGER if
both arguments are INTEGER.
Starting with Release 10.1B, all intermediate calculations are
carried out in 64-bit arithmetic. With the introduction of the INT64 data type,
any operator or function that used to return an INTEGER can
now return a value greater than 32-bits. This large value is held
correctly as an intermediate value and does not generate an error
message unless you assign the final result into an INTEGER database
field, temp-table field, program variable, or parameter. This means
that if you try to store a value outside the -2147483648 to +2147483647
range in an INTEGER, you get an error message.
For example, 2,000,000,000 * 100 / 100 gives the correct result
whether the target field is INTEGER or INT64.
However, although 2,000,000,000 * 100 does not cause an overflow,
the result must be assigned to an INT64 field.
It generates a run-time error if you assign it to an INTEGER field.
If you have an existing field, program variable, or parameter
defined with the INTEGER data type, and you want
to make it 64-bit capable, you must change the data type to INT64.
You can change the data type of a database field via the Data Dictionary
tool. Note that you can make this change without having to dump
and load the data. However, when you change the data type of a database
field, you change the Cyclic Redundancy Check (CRC) of the database
table that contains the field. Therefore, you must recompile your
r-code. In addition, you should review your code for any references
to the database field to determine whether there is a possibility
of an overflow with the INTEGER data type.