Int64 is the 64-bit signed whole-number type you use in MDriven Designer when an attribute or calculation must store integer values beyond the range of Int32.
What Int64 stores
Int64 stores whole numbers only: it has no fractional part. It uses 64 bits and supports values from -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807.
Use Int64 for values such as a large counter, an externally supplied numeric identifier, or a quantity that can exceed the Int32 range.
For example, a total of 5000000000 requires Int64 because it is greater than the maximum value of a 32-bit signed integer.
Use Int64 for model attributes
When you define a class attribute in MDriven Designer, select Int64 when the value must be a signed whole number and its expected range may exceed Int32.
| Requirement | Suitable type | Example |
|---|---|---|
| Whole number within the Int32 range | Int32 | Number of items in a small order |
| Whole number that can exceed the Int32 range | Int64 | A counter with the value 5000000000
|
| Number that requires fractional digits | Decimal | A measured or monetary amount with a fractional part |
Do not use Int64 for values that need decimal places. Use the appropriate decimal type instead; see Documentation:Precision for precision, scale, and length settings.
Use Int64 in OCL
You can use Int64 values in OCL expressions where a whole-number value is required. MDriven OCL has no long operator keyword. Refer to the type as Int64, not long.
For example, an Int64 attribute named TotalCount can participate in integer arithmetic:
self.TotalCount + 1Integer arithmetic produces whole-number results. Division does not retain a fractional part, so use a decimal type when the calculation must preserve fractions.
Range and overflow
An Int64 result must remain within the Int64 range. Addition, subtraction, multiplication, or other calculations that produce a value below the minimum or above the maximum cannot be represented as Int64. Treat values near either limit with care.
For example, adding 1 to 9223372036854775807 exceeds the largest Int64 value.
Random values
There is no random function on Int64. Int32.Random generates Int32 values only.
For example, Int32.Random(100) returns an integer from 0 through 99; it never returns 100. Do not expect an equivalent Int64.Random operation.
See also
[[Category:Attributes and data types [Beginner]]]
