Reference Guide > D Routines > DOUBLE Function
  

DOUBLE Function
The DOUBLE function does the following:
*Converts an expression to double-precision floating-point data type.
*Extracts data from an expression and places it in a double-precision floating-point scalar or array.
enabled.
Usage
This form is used to convert data:
result = DOUBLE(expr)
This form is used to extract data:
result = DOUBLE(expr, offset, [dim1, ..., dimn ])
Input Parameters
To convert data:
expr — The expression to be converted.
To extract data:
expr — The expression from which to extract data.
offset — The offset, in bytes, from the beginning of expr to where the extraction is to begin.
dimi — (optional) The dimensions of the result. May be any scalar expression. Up to eight dimensions may be specified.
Returned Value
For data conversion:
result — A copy of expr converted to double-precision floating-point data type.
For data extraction:
result — If offset is used, DOUBLE does not convert result, but allows fields of data extracted from expr to be treated as double-precision floating-point data. If no dimensions are specified, the result is scalar.
Keywords
None.
Example
In this example, DOUBLE is used in two ways. First, DOUBLE is used to convert an integer array to double precision, floating point. Next, DOUBLE is used to extract a subarray from the double precision array created in the first step.
; Create an integer vector of length 6 that is initialized to the
; a = INDGEN(6) value of its one-dimensional subscript.
a = INDGEN(6)
PRINT, a
; PV-WAVE prints: 0  1  2  3  4  5
; Convert a to double precision, floating point.
b = DOUBLE(a)
INFO, b
; PV-WAVE prints: B       DOUBLE    = Array(6)
PRINT, b
; PV-WAVE prints:
;   0.00000000    1.0000000    2.0000000    3.0000000
;   4.0000000     5.0000000
; Extract the last four elements of b, and place them in
; a 2-by-2 double-precision, floating-point array.
c = DOUBLE(b, 16, 2, 2)
INFO, c
; PV-WAVE prints: C           DOUBLE    = Array(2, 2)
PM, c
; PV-WAVE prints:
;    2.0000000      4.0000000
;    3.0000000      5.0000000
 
note
If you want to place the double-precision value of a constant into a variable, it is much better to use the d or D constant notation rather than the double function. Because passing a float to the DOUBLE function will not produce the desired precision. For example:
x = .0705230784D
See Also
BYTECOMPLEX,   DBLARR,   DCOMPLEX,   FIX, FLOAT, INT32,  LONG, alibDouble
For more information on using this function to extract data, see the PV‑WAVE Programmer’s Guide.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.