FLOAT

 

FLOAT data type is a number data type that is used to store values in the format of double-precision floating-point binary numbers that can have 16 significant digits or fewer. A FLOAT data type requires 8 bytes to store a value.

DOUBLE PRECISION is a synonym for FLOAT.

The actual precision of the data of FLOAT data type depends on the compiler and on the data, but generally it is possible to declare a whole number in the range of 1 to 14 as the precision for a FLOAT data type. The FLOAT data type is generally used to store some scientific data that do not require high precision and can be calculated approximately. To store precise data, use the DECIMAL data type.

The data entered into a table column of FLOAT data type can differ from the data Querix 4GL will display, as the FLOAT data type stores only most significant digits. Such error occurs because the floating-point numbers are stored internally in binary numeration format. If you enter 1.1 into a table column of FLOAT data type, Querix 4GL will display it as 1.09999999. The exact floating-point binary representation of the decimal numeration value may require an infinite number of digits, whereas only a finite number of digits can be physically stored. So an approximate number is stored. Statements of Querix 4GL can specify FLOAT values as floating-point literals. A floating point literal has the following structure: (-)m.mE(-)e: ‘m’ represents a digit belonging to the mantissa, ‘e’ represents a digit belonging to the exponent, (-) are the mantissa and exponent signs that are optional. The omitted mantissa or exponent sign will be treated as positive by default. In the floating-point literals, you can use ‘E’ (either upper or lower case) as the exponent symbol.

If another number format is entered into FLOAT field, or of it is supplied by the program, Querix 4GL makes an attempt to convert it into the FLOAT data type. You can use the USING operator to format the display of the numbers of the FLOAT data type. By default, two decimal places will be displayed, if no formatting has been performed.

util.Math class provides a set of basic mathematical functions based on FLOAT numbers:

util.Math.sin()

util.Math.cos()

util.Math.tan()

util.Math.asin()

util.Math.acos()

util.Math.atan()

util.Math.exp()

util.Math.log()

util.Math.pi()

util.Math.pow()

util.Math.rand()

util.Math.srand()

util.Math.sqrt()

util.Math.toRadians()

util.Math.toDegrees()

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.