The PowerBuilder numeric datatypes are listed here in order of highest to lowest precedence (the order is based on the range of values for each datatype):
Double
Real
Decimal
LongLong
UnsignedLong
Long
UnsignedInteger
Integer
Byte
Datatypes of operands If operands in an expression have different datatypes, the value whose type has lower precedence is converted to the datatype with higher precedence.
Unsigned versus signed Unsigned has precedence over signed, so if one operand is signed and the other is unsigned, both are promoted to the unsigned version of the higher type. For example, if one operator is a long and another UnsignedInteger, both are promoted to UnsignedLong.
Operators The effects of operators on an expression’s datatype are:
+, -, * The minimum precision for addition, subtraction, and multiplication calculations is long. Integer types are promoted to long types before doing the calculation and the expression’s resulting datatype is, at a minimum, long. When operands have datatypes of higher precedence, other operands are promoted to match based on the Datatypes of operands rule above.
/ and ^ The minimum precision for division and exponentiation is double. All types are promoted to double before doing the calculation, and the expression’s resulting datatype is double.
Relational Relational operators do not cause promotion of numeric types.
When a literal is an operand in an expression, its datatype is determined by the literal’s value. The datatype of a literal affects the type promotion of the literal and other operands in an expression.
Literal |
Datatype |
---|---|
Integer literals (no decimal point or exponent) within the range of Long |
Long |
Integer literals beyond the range of Long and within the range of UnsignedLong |
UnsignedLong |
Integer literals beyond the range of UnsignedLong and within the range of LongLong |
UnsignedLong |
Numeric literals with a decimal point (but no exponent) |
Decimal |
Numeric literals with a decimal point and explicit exponent |
Double |