Type conversionΒΆ

When operations are performed using fields or constants of different types, Sculptor deals intelligently with the data involved. Firstly the types of both operands are examined. If they are of the same type, the result will also have that type. If they differ, a type conversion is performed according to the following rules:

1

If either operand is floating point, then the other is converted to floating point and the result is floating point.

2

Otherwise, if either operand is a fixed point number, the other operand is converted to a fixed point number, and the result is a fixed point number.

3

Otherwise, if either operand is integer then the other operand is converted to integer and the result is integer.

4

If both operands are alphanumeric, the result is alphanumeric.

On assignment, the value being assigned is converted to the type of the receiving field.

If floating point values are converted to integer, then the fractional part is lost. Similarly, conversion of floating point to number type fields results in the fractional part being truncated after the number of decimal places specified. The Sculptor system variable sys.Rounding may be set to ON in order to force rounding prior to conversion.

When fixed point numbers are added or subtracted, the number of decimal places in the result is the maximum of the number of decimal places in each argument.

When fixed point numbers are multiplied or divided, the number of decimal places in the result is the sum of the number of decimal places in each argument, but not exceeding the value in sys.MaxIDP.