Double

This keyword declares a double precision floating value with a precision that may depend on the hardware. It is therefore strongly recommended not to use this keyword anymore, and to replace it by Decimal variables.

Syntax

Local    Double NAME
Local    Double NAME(DIMENSIONS)
Variable Double NAME(DIMENSIONS)
Value    Double NAME(DIMENSIONS)
Const    Double NAME(DIMENSIONS)
  • NAME is the name of the variable declared.
  • DIMENSIONS can be:
    • A single numeric value DIM, meaning that you have an array with an index range from 0 to DIM-1.
    • A range of numeric values INDEX1..INDEX2, where the index varies between INDEX1 and INDEX2.
    • Several indexes or index ranges separated by a comma. For multiple dimension arrays, up to four dimensions are possible.

Several variable declarations can be done on the same line, separated by a comma.

Local declarations create the variables in the current local variable class that is not seen by nested or calling subprograms. The Call / Subprog and func / Funprog insulate the local variables, as well as the calls of method by fmet.

Const, Variable, and Value declarations state the arguments sent by a Call, func, or fmet. With these syntaxes, the dimensions and the index ranges can be omitted wherever the parenthesis is present. The dimension and index ranges are defined by the calling program.

Example

# Direct declarations
Local Double CURRENCY_RATE, EOM_RATE : # Local double precision variables
Local Double WEIGHTING_MEASURES(1..12) : # An array of 12 double precision values
# A sub-program computing a result from double precision values 
Funprog COMPUTE_VALUE(MEASURES)
Variable Double MEASURES(,) : # A 2 dimensions matrix of double precision variables is sent as reference
...
End SEND_STATUS
# A sub-program storing floating point values
Subprog STORE_VALUES(VOLTAGE_MEASURES)
Value Float VOLTAGE_MEASURES(1..20) : # An array of 20 elements is sent (a copy is done when passing the arguments)
...
End

Comments

There is still a Global declaration variable that exists for variables that have to be seen in the scope of a process execution, but its use is strongly discouraged.

Implicit data type conversion

The Double data type will implicitly convert Tinyint, Shortint, Integer, Float and Decimal to a Double precision value. Note that precision may be lost in the type conversion as shown in the example below.
...


Local Double MY_DOUBLE # Declare Double
MY_DOUBLE = 42949672951 # MY_DOUBLE= 4.294967295e+10

...

See also

Global, Local, Variable, Value, Const, Tinyint, Date, Shortint, Integer, Float, Decimal, Char, Clbfile, Blbfile, Uuident, Datetime, Instance.