Fixed-point data types

The fixed-point data types are exact data types. The system generates an error if a value in the input field cannot be expressed without loss of accuracy in the target table or database.

Syntax
['+'|'-']<digit>…['.'[<digit>…]]
['+'|'-']'.'<digit>…
['+'|'-']<digit>…[','[<digit>…]]
['+'|'-']'.'<digit>
Description
  • Optional leading sign
  • Unlimited leading zeros
  • At least one decimal digit
Limitations
  • No thousands-separator commas
  • No support for exponential notation

The syntax of fixed-point values is the same as the syntax of integer values with the addition of an optional decimal digit. This optional decimal digit can occur anywhere: from before the first decimal digit to after the last decimal digit.

The optional decimal point can be followed by zero or more decimal digits if there is at least one decimal digit before the decimal point. The optional decimal point can be followed by one or more decimal digits if there are no decimal digits before the decimal point.

If there is no explicit decimal point, the system assumes a decimal point immediately following the last decimal digit.

You can also specify a comma as a separator by using it like the decimal point.

The following table describes the fixed-point precision and representation:

Precision (P) Representation
P ≤ 9 4 bytes, signed
9 < P ≤ 18 8 bytes, signed
18 < P ≤ 36 16 bytes signed
The following conditions result in system errors:
  • Having more decimal digits before the decimal point than the declaration allows (P - S, where S is the scale)
  • Having more decimal digits that follow the decimal point than the declared scale allows

Because the fixed-point data type is an exact data type, when there are too many digits that follow the decimal point, the system does not round the number.