Informix Error -1222: Value will not fit in a SMALLFLOAT.
Cause and resolution
Value will not fit in a SMALLFLOAT.
The SMALLFLOAT data type can accept numbers within a certain range of exponents. The maximum and minimum exponent values are different depending on the host operating system (the range is the same as that supported by the C compiler for float values in this system). In the current statement, a constant number is being converted for storage in a FLOAT variable or column, and the exponent is too large or too small.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1222 fires when a numeric constant's exponent falls outside what SMALLFLOAT can represent —
per the official guidance, SMALLFLOAT's acceptable exponent range varies by operating system,
matching the platform's C compiler's float specification.
- A value with an exponent larger than
SMALLFLOAT's platform-specific maximum, per the official guidance — the direct, common cause. - A value with an exponent smaller (closer to zero, i.e. underflowing) than
SMALLFLOAT's platform-specific minimum, per the official guidance — the mirror-image case.
Solutions / Resolution
- Use
FLOAT/DOUBLE PRECISIONinstead ofSMALLFLOAT, if the value's exponent genuinely exceeds what the platform'sSMALLFLOAT(matching Cfloat) can hold. - Check the platform's specific
SMALLFLOATexponent range, per the official guidance, since it varies by operating system/C compiler rather than being a single fixed constant.
Examples
A value with an exponent beyond SMALLFLOAT's range
DEFINE v_val SMALLFLOAT;
LET v_val = 1.0e100;
-- -1222: the exponent exceeds this platform's SMALLFLOAT (C float) range
Corrected — widen the type
DEFINE v_val FLOAT;
LET v_val = 1.0e100;
Diagnostic Checks
- Check the value's exponent against the platform's specific
SMALLFLOAT/Cfloatrange, since this varies by operating system.
Related Errors / Related Topics
- -1214 — "Value too large to fit in a SMALLINT." A related type-range error, for an integer type rather than a floating-point one.
- -1215 — "Value too large to fit in an INTEGER." Another related integer type-range error.
The value's exponent falls outside SMALLFLOAT's platform-specific range — use FLOAT/DOUBLE PRECISION if a wider range is needed.