Float

This keyword declares a 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 with Decimal variables.

Syntax

Local Float NAMELocal Float NAME(DIMENSIONS)Variable Float NAME(DIMENSIONS)Value Float NAME(DIMENSIONS)Const Float NAME(DIMENSIONS)

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 declare the arguments sent by a Call, func, or fmet. With these syntaxes, the dimensions and the index ranges can be omitted when the parenthesis is present. The dimension and index ranges are defined by the calling program.

Example

# Direct declarationsLocal Float CURRENCY_RATE, EOF_RATE : # Local floating point variablesLocal Float WEIGHTING_MEASURES(1..12) : # An array of 12 floating point values# A sub-program computing a result from floating points values Funprog COMPUTE_VALUE(MEASURES)Variable Float MEASURES(,) : # A 2 dimensions matrix of floating point variables is sent as reference...End SEND_STATUS# A sub-program storing floating point valuesSubprog 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 must be seen in the scope of a process execution, but its use is strongly discouraged.

Implicit data type conversion

The Float data type will implicitly convert [Tinyint](../4gl/tinyint.md), [Shortint](../4gl/shortint.md), [Integer](../4gl/integer.md), [Double](../4gl/double.md) and [Decimal](../4gl/decimal.md) to a Floating point.. Note that precision may be lost in the type conversion as shown in the example below.
# Declare Float and assign valueLocal Float MY_FLOAT MY_FLOAT = 42949672951# Value retrieved = 4.29497e+10

See also

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