1.1.10 Float

A Float is an approximate numeric field that stores floating point numeric data (as opposed to fixed point like Signed and Packed). Floating point data is approximate. Not all values in the field type range can be precisely represented. Floats are classed as Numbers in LANSA.

Fields of type Float may only be used in an arithmetic expression. Floats cannot be displayed in a component or function.

A Float is defined by the number of bytes used to store the value. The higher number of bytes, the more accurate the number. A 4 byte Float is accurate while the number of digits is less than or equal to 6. An 8 byte Float is accurate while the number of digits is less than or equal to 15.

The following table provides the accurate length for each of the possible byte lengths for a Float. The accurate length may be considered equivalent to the actual length of a signed or packed field. The table also notes the possible number of decimal places at runtime.

# Bytes

Accurate # digits (accurate length)

Possible decimal places

4

6

0 - 6

8

15

0 - 15

 

Please review the general 1.1.1 Field Type Considerations.

Field Definition Rules

Rules for defining a Float field in the repository are:

Length

Floats may be 4 or 8 bytes in length. Decimals must always be zero.

Valid Keyboard Shift

Blanks

Allowed Attributes

AB, ASQN, CS, FE, ND, RA, RB, RL, RLTB.

Edit Mask

Not allowed.

Default

*NULL

Usage Rules

Partition Type

RDMLX Enabled Partition

Files

Floats may only be used in RDMLX Files. Floats may be used as real fields. Use of Floats as key fields is not recommended.

Logical Views

Use of Floats as key fields is not recommended.

Virtual Fields

Floats may only used with Mathematical Virtual Fields. Floats may be used as the source field(s).

Floats may be used with Code Fragment Virtual Fields.Floats must not be used with Substring, Concatenation or Date Virtual Fields.

Predetermined Join Fields

Floats may be used for numeric predetermined joined fields.

RDML Commands

Fields of type Float may only be used in an arithmetic expression.

For example,  DISPLAY, REQUEST, POP_UP, DEF_HEAD, DEF_FOOT DEF_BREAK, and DEF_LINE cannot support fields of type Float. Visual LANSA components have no mechanism for displaying fields of type Float.

Built-In Functions

When used in Built-In Functions, floats are valid for arguments of type 'N'.

As the value for a field of type Float may have anywhere between 0 and 15 decimal places at execution time, it is generally not considered suitable as a numeric argument to a BIF as it is not possible to predict the actual number of decimal places.

Special Values

*NULL, *NAVAIL, *HIVAL, *LOVAL, *REMEMBERED_VALUE

Conversion

It is wrong to convert Floats to/from Date and Time fields. Refer to Field Type Conversions.

Usage Notes

Platform Considerations

Tips & Techniques

Also See

1.1.7 Packed

1.1.8 Signed

1.1.9 Integer