Numeric types - Manhunter07/MFL GitHub Wiki
Numeric types are types that support only numbers. They are used on function parameters for example, when a certain argument must be a special kind of number.
The following types support all or a subset of numbers and are declared in the System
package.
Type | Supported values |
---|---|
Number |
All numbers (including Inf and NaN ) |
Positive |
All positive numbers (including 0 , Inf and NaN ) |
Negative |
All negative numbers (including 0 , -Inf and NaN ) |
PosInt |
Positive integer numbers (including 0 ) |
NegInt |
Negative integer numbers (including 0 ) |
Int8 |
Integer numbers between -128 and 127
|
Int16 |
Integer numbers between -32768 and 32767
|
Int32 |
Integer numbers between -2147483648 and 2147483647
|
Int64 |
Integer numbers between -9223372036854775808 and 9223372036854775807
|
UInt8 |
Positive integer numbers between 0 and 255
|
UInt16 |
Positive integer numbers between 0 and 65535
|
UInt32 |
Positive integer numbers between 0 and 4294967295
|
UInt64 |
Positive integer numbers between 0 and 18446744073709551615
|
Additionally, there are a number of type constructors available for more specific constraints. The following type constructors support only numeric types.
Type constructor | Supported values |
---|---|
integer |
Any integer numbers (with no fractional part) |
integer(DivisorList...) |
Integers that are dividable by the given divisors |
rangeint(MinValue, MaxValue) |
Integers that are within the range of MinValue and MaxValue
|
rangeint(MinValue, MaxValue, DivisorList...) |
A combination of integer and range where the values must be integers both within the range of MinValue and MaxValue , and dividable by the given divisors |
sizeint(Signed, ByteSize) |
Signed or unsigned integers that fit within the value range of ByteSize
|