Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » SQL Data Types » Numeric data types

DOUBLE data type Next Page

FLOAT data type

The FLOAT data type is used to store a floating point number, which can be single or double precision.


FLOAT [ ( precision ) ]


precision    An integer expression that specifies the number of bits in the mantissa. A mantissa is the decimal part of a logarithm. For example, in the logarithm 5.63428, the mantissa is 0.63428. The IEEE standard 754 floating-point precision is as follows:

Supplied precision valueDecimal precisionEquivalent SQL data typeStorage size
1-247 decimal digitsREAL4 bytes
25-5315 decimal digitsDOUBLE8 bytes

When a column is created using the FLOAT ( precision ) data type, columns on all platforms are guaranteed to hold the values to at least the specified minimum precision. In contrast, REAL and DOUBLE do not guarantee a platform-independent minimum precision.

If precision is not supplied, the FLOAT data type is a single precision floating point number, equivalent to the REAL data type, and requires 4 bytes of storage.

If precision is supplied, the FLOAT data type is either single or double precision, depending on the value of precision specified. The cutoff between REAL and DOUBLE is platform-dependent. Single precision FLOAT values require 4 bytes of storage, and double precision FLOAT values require 8 bytes.

The FLOAT data type is an approximate numeric data type. It is subject to round-off errors after arithmetic operations. The approximate nature of FLOAT values means that queries using equalities should generally be avoided when comparing FLOAT values.

You can tune the behavior of the FLOAT data type for compatibility with Adaptive Server Enterprise, using the float_as_double option [compatibility].

See also
Standards and compatibility