NORMALIZE_DECFLOAT

The NORMALIZE_DECFLOAT function returns a DECFLOAT value equal to the input argument set to its simplest form.

Read syntax diagramSkip visual syntax diagramNORMALIZE_DECFLOAT( expression)

The NORMALIZE_DECFLOAT function returns a decimal floating-point value equal to the input argument set to its simplest form; that is, a non-zero number with trailing zeros in the coefficient has those zeros removed. This may require representing the number in normalized form by dividing the coefficient by the appropriate power of ten and adjusting the exponent accordingly. A zero value has its exponent set to 0.

expression
An expression that returns a value of any built-in numeric, character-string, or graphic-string data type. If the data type of the argument is SMALLINT, INTEGER, REAL, DOUBLE, DECIMAL(p,s) where p <=16, or NUMERIC(p,s) where p <=16, then the argument is converted to DECFLOAT(16) for processing. Otherwise, the argument is converted to DECFLOAT(34) for processing.

If the argument is a special value then the general rules for arithmetic operations apply. See General arithmetic operation rules for DECFLOAT for more information.

The result of the function is a DECFLOAT(16) value if the data type of expression after conversion to decimal floating-point is DECFLOAT(16). Otherwise, the result of the function is a DECFLOAT(34) value. If the argument can be null, the result can be null; if the argument is null, the result is the null value.

Examples

The following examples show the result of using the NORMALIZE_DECFLOAT function on various DECFLOAT values:

 NORMALIZE_DECFLOAT(DECFLOAT(2.1))          =   2.1
 NORMALIZE_DECFLOAT(DECFLOAT(-2.0))         =  -2
 NORMALIZE_DECFLOAT(DECFLOAT(1.200))        =   1.2
 NORMALIZE_DECFLOAT(DECFLOAT(-120))         =  -1.2E+2
 NORMALIZE_DECFLOAT(DECFLOAT(120.00))       =   1.2E+2
 NORMALIZE_DECFLOAT(DECFLOAT(0.00))         =   0
 NORMALIZE_DECFLOAT(-NAN)                   =   -NAN
 NORMALIZE_DECFLOAT(-INFINITY)              =   -INFINITY