DOUBLE_PRECISION or DOUBLE

The DOUBLE_PRECISION and DOUBLE functions returns a floating-point representation of either a number or a character-string or graphic-string representation of a number, an integer, a decimal number, or a floating-point number.

Numeric to Double:

Read syntax diagram
>>-+-DOUBLE_PRECISION-+-(numeric-expression)-------------------><
   '-DOUBLE-----------'                        

String to Double:

Read syntax diagram
>>-+-DOUBLE_PRECISION-+-(string-expression)--------------------><
   '-DOUBLE-----------'                       

The schema is SYSIBM.

Numeric to Double

numeric-expression
An expression that returns a value of any built-in numeric data type.

The result is the same number that would occur if the expression were assigned to a double precision floating-point column or variable.

String to Double

string-expression
An expression that returns a value of a character or graphic string (except a CLOB or DBCLOB) with a length attribute that is not greater than 255 bytes. The string must contain a valid string representation of a number.

The result is the same number that would result from CAST(string-expression AS DOUBLE PRECISION). Leading and trailing blanks are removed from the string, and the resulting substring must conform to the rules for forming a valid string representation of an SQL floating-point, integer, or decimal constant.

The result of the function is a double precision floating-point number.

The result can be null; if the argument is null, the result is the null value.

Note: To increase the portability of applications, use the CAST specification. For more information, see CAST specification.

FLOAT can be specified as a synonym for DOUBLE or DOUBLE_PRECISION.

Example: Using sample table DSN8A10.EMP, find the ratio of salary to commission for employees whose commission is not zero. The columns involved in the calculation, SALARY and COMM, have decimal data types. To eliminate the possibility of out-of-range results, apply the DOUBLE function to SALARY so that the division is carried out in floating-point.
   SELECT EMPNO, DOUBLE(SALARY)/COMM
     FROM DSN8A10.EMP
     WHERE COMM > 0;