Convert numbers to numbers
If two values of different numeric data types operate
on one another, Informix®
ESQL/C converts
the values to the data type that the following table indicates and
then performs the operation.
Operands | DEC | FLOAT | INT | SERIAL | SMALLFLOAT | SMALLINT |
---|---|---|---|---|---|---|
DEC | DEC | DEC | DEC | DEC | DEC | DEC |
FLOAT | DEC | FLOAT | FLOAT | FLOAT | FLOAT | FLOAT |
INT | DEC | FLOAT | INT | INT | FLOAT | INT |
SERIAL | DEC | FLOAT | INT | INT | FLOAT | INT |
SMALLFLOAT | DEC | FLOAT | FLOAT | FLOAT | FLOAT | FLOAT |
SMALLINT | DEC | FLOAT | INT | INT | FLOAT | INT |
Data types for which ESQL/C carries out numeric operations shows that if Informix® ESQL/C performs an operation between an operand with a data type of FLOAT and a second operand with a data type of DECIMAL (DEC), Informix® ESQL/C generates a result that has a DECIMAL data type.