Number Type ("M" Reference)
[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]
The Numeric type encompasses all numeric values.
Operators
The unary operations in the following table take Number as a right operand.
Operator | Return |
---|---|
+, - |
Number |
The binary operations in the following table take Number as a left operand.
Operator | Right Operand | Return |
---|---|---|
+, - |
Number |
Number |
*, /, % |
Number |
Number |
>, <, <=, >=, ==, != |
Number |
Logical |
Remarks
The following operations may cause underflow and overflow errors:
The predefined unary - operator.
The predefined +, -, *, and / binary operators.
Explicit numeric conversions from one Number type to another.
If all of the operands are constant expressions, underflow and overflow is a compile error; otherwise, underflow and overflow is a runtime error.
The following operations may cause a divide by zero error:
- The predefined / and % binary operators.
If the second operand (the denominator) is a constant expression, divide by zero is a compile error; otherwise, divide by zero is a runtime error.
Number is an abstract type with the following four abstract subtypes:
Decimal
Integer
Scientific
Unsigned
Each of these subtypes is further refined to a concrete type with a precision. A concrete type of a smaller precision can always be converted to the same type of a larger precision. Converting from a larger precision to a smaller precision tests for overflow at runtime.
The arithmetic operations (+, -, *, /, %) previously defined are specialized to return the most specific type of its operands (for example, Integer8
+ Integer8
returns Integer8
or Decimal9
+ Decimal38
returns Decimal38
).
Code Example
The following code shows the Millimeters
field being declared as a Number type and receiving the value of 43.
Millimeters : Number = 43;