eXtremeSQL Numeric Fields

eXtremeSQL understands the standard SQL type NUMERIC. It stores NUMERIC fields internally as 8 byte integer values with a specified width and precision. When performing operations (in SQL statements) on database fields, and converting the resulting values to result set rows, the precision of the result is determined by the following rules (where P1 and P2 represent the precision of the operands):

Operation Result Precision
P1+ P2 max(P1,P2)
P1- P2 max(P1,P2)
P1* P2 P1+P2
P1/ P2 max(P1-P2, 0)

Also, when NUMERIC values are compared, the precision of the result is max(P1,P2).