DOUBLE

Description

64-bit binary floating-point (DOUBLE) is a numerical data type used to represent real numbers, capable of storing very large or very small values. In computer systems, 64-bit floating-point numbers follow the IEEE 754 standard, providing approximately 15-17 digits of precision.

Syntax

DOUBLE

Example

  1. Return the 64-bit floating-point representation of the positive integer 1:
    SELECT +1D;
  2. Convert the integer -6 to a 64-bit floating point representation:
    SELECT CAST(-6 AS DOUBLE);
  3. Return the value 1.99714E+13 in scientific notation:
    SELECT 1.99714E+13;
  4. Convert string floating-point numbers to 64 bit floating-point numbers:
    SELECT CAST('123.456' AS DOUBLE);
  5. Calculate the sum of two 64-bit floating-point numbers:
    SELECT CAST(123.45 AS DOUBLE) + CAST(678.91 AS DOUBLE);
6. Compare the size of two 64-bit floating-point numbers:
SELECT CAST(123.456 AS DOUBLE) > CAST(122.345 AS DOUBLE);
  1. Calculate the square root of a 64-bit floating point number:
    SELECT SQRT(CAST(16 AS DOUBLE));

Precautions

  • FLOAT or DOUBLE. This is because the representation of floating-point numbers in computers may lead to precision loss, resulting in inaccurate outcomes during comparison and association operations,