NORMALIZE_DECFLOAT

The NORMALIZE_DECFLOAT function returns a DECFLOAT value that is the result of the argument, set to its simplest form. That is, a non-zero number that has any trailing zeros in the coefficient has those zeros removed by dividing the coefficient by the appropriate power of ten and adjusting the exponent accordingly. A zero has its exponent set to 0.

Read syntax diagram
>>-NORMALIZE_DECFLOAT(decfloat-expression)---------------------><

The schema is SYSIBM.

decfloat-expression
The argument must be an expression that returns a DECFLOAT value.

Start of changedecfloat-expression can also be a character string or graphic string data type. The string input is implicitly cast to a numeric value of DECFLOAT(34).End of change

If the argument is a special decimal floating point 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 decfloat-expression is DECFLOAT(16). Otherwise, the result of the function is a DECFLOAT(34) value.

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