Non-integer Numbers

    Floating-point and fixed-point numbers are used to specify non-integer numbers. Different floating point datatypes represent different precisions numbers.

    • DOUBLE and are aliases.
    • non_integer_floating_point_literal is used for values of FLOAT, DOUBLE and DOUBLE PRECISION types.
    • non_integer_fixed_point_literal is used for values of DECIMAL type.
    • Values of different floating-point and fixed-point datatypes are comparable and convertible to one another.
      • Conversion from floating-point types into DECIMAL will raise an error for the special values NaN, , and -Infinity.
    • The ordering for special floating-point values is defined as (in ascending order): -Infinity, all negative values in order, all positive values in order, Infinity, and NaN.

    You can do this as shown below.

    1. cqlsh:example> CREATE TABLE sensor_data (sensor_id INT PRIMARY KEY, float_val FLOAT, dbl_val DOUBLE, dec_val DECIMAL);
    1. cqlsh:example> UPDATE sensor_data SET float_val = 1, dbl_val = 1, dec_val = 1 WHERE sensor_id = 2;
    1. sensor_id | float_val | dbl_val | dec_val
    2. -----------+-----------+-----------+-------------
    3. 1 | 321.04568 | 321.04568 | 321.0456789

    Data Types