NUMERIC data types

Informix® supports several data types to store numbers:

Table 1. Informix numeric data types
Informix data type Description
SMALLINT 16 bit signed integer
INT / INTEGER 32 bit signed integer
BIGINT 64 bit signed integer
INT8 64 bit signed integer (replaced by BIGINT)
DEC / DECIMAL Equivalent to DECIMAL(16)
DEC(p) / DECIMAL(p) Floating-point decimal number
DEC(p,s) / DECIMAL(p,s) Fixed-point decimal number
MONEY Equivalent to DECIMAL(16,2)
MONEY(p) Equivalent to DECIMAL(p,2)
MONEY(p,s) Equivalent to DECIMAL(p,s)
REAL / SMALLFLOAT 32-bit floating point decimal (C float)
DOUBLE PRECISION / FLOAT[(n)] 64-bit floating point decimal (C double)

Genero db supports the following:

Table 2. Genero db numeric data types
Genero db data type Pseudotype Description
SMALLINT TINYINT / BIT 16-bit signed integer
INT / INTEGER   32-bit signed integer
BIGINT   64-bit signed integer
INT8   64-bit signed integer
DECIMAL(p,s)   Fixed-point decimal number (p<=15 with GDS 3.61)
NUMERIC(p,s)   Fixed-point decimal number (p<=15 with GDS 3.61)
MONEY   Number with precision nearly 19 and scale 4
DOUBLE / DOUBLE PRECISION / REAL SMALLFLOAT / FLOAT(n) Approximate 64-bit floating point real number (C double)
Note:
  1. With Genero db 3.61, the maximum number of digits is 15, while Genero db 3.80 supports up to 36digits.
  2. The only difference between DECIMAL and NUMERIC is that NUMERIC guarantees the specified precision, whereas DECIMAL guarantees at least the specified precision.
  3. A pseudotype is accepted anywhere a regular type name is, but is silently converted into another type which is supported by Genero db.

Solution

We recommend that you use the following conversion rules:

Table 3. Numeric data type conversion rules (Informix - Genero db)
Informix data type Genero db data type
SMALLINT SMALLINT
INTEGER INTEGER
BIGINT BIGINT
INT8 BIGINT
DECIMAL (equivalent to DECIMAL(16)) N/A until Genero db 3.90
DECIMAL(p) N/A until Genero db 3.90
DECIMAL(p,s) DECIMAL(p,s) with p <=15 if Genero db 3.61
MONEY(p,s) DECIMAL(p,s) with p <=15 if Genero db 3.61
REAL / SMALLFLOAT REAL (64b!)
DOUBLE PRECISION / FLOAT(n) FLOAT
Note: Genero db does not have a 32-bit floating point type, Informix SMALLFLOAT has to be converted to REAL, which is a 64-bit floating point type in Genero db. Later, when extracting the schema of the database, the original type name used to create the table in Genero db can be used to distinguish 32-bit from 64-bit types in the .sch schema file.