Describes the Firebolt implementation of the NUMERIC
data type
NUMERIC
data type.
NUMERIC
data type is an exact numeric data type defined by its precision (total number of digits) and scale (number of digits to the right of the decimal point).
NUMERIC
has two optional input parameters: NUMERIC(precision, scale)
The maximum precision is 38. The scale value is bounded by the precision value (scale<=precision)
.
The precision must be positive, while the scale can be zero or positive.
The DECIMAL
data type is a synonym to the NUMERIC
data type.
precision | bytes |
---|---|
1-9 | 4 |
10-18 | 8 |
18-38 | 16 |
NUMERIC
data type, then it defaults to NUMERIC(precision, min(9, precision))
If both the precision and scale are not specified, then it defaults to NUMERIC(38, 9)
NUMERIC
precision and scale does not change with any operation, i.e., there is no automatic widening of the result type to prevent overflows. If a wider type is desired, cast the inputs to perform the operations on wider types.
NUMERIC
s with different precision and/or scale requires explicit casting of the input to the desired precision and scale.
NUMERIC
s have the same precision and scale, the result will implicitly cast to the same precision and scale. You can still explicitly cast to any other precision and scale.