Float
Name |
Description |
Storage Space |
Value Range |
Literal |
---|---|---|---|---|
REAL |
Real number |
32 bits |
1.40129846432481707e-45 to 3.40282346638528860e+38, positive or negative |
REAL |
DOUBLE |
Double-precision floating point number with 15 to 17 valid digits, depending on the application scenario. The number of valid digits does not depend on the decimal point. |
64 bits |
4.94065645841246544e-324 to 1.79769313486231570e+308, positive or negative |
DOUBLE |
FLOAT |
Single-precision floating point number with 6 to 9 valid digits, depending on the application scenario. The number of valid digits does not depend on the decimal point. |
32 bits |
1.40129846432481707e-45 to 3.40282346638528860e+38, positive or negative |
FLOAT |
- When a distributed query uses high-performance hardware instructions to perform single-precision or double-precision computing, the computing result may be slightly different because the execution sequence is different each time when an aggregate function, such as SUM() or AVG(), is invoked. Especially when the data volume is large (tens of millions or even billions of records), the computing result may be slightly different. In this case, you are advised to use the DECIMAL data type.
- An alias can be used to specify the data type.
--Create a table that contains float data. CREATE TABLE float_t1 (float_col1 FLOAT) ; --Insert data of the float type. insert into float_t1 values (float '3.50282346638528862e+38'); --View data. SELECT * FROM float_t1; float_col1 ------------ Infinity (1 row) --Drop the table. DROP TABLE float_t1;
- When the decimal part is 0, you can use cast() to convert the decimal part to an integer of the corresponding range. The decimal part is rounded off.
Example:
select CAST(1000.0001 as INT); _col0 ------- 1000 (1 row) select CAST(122.5001 as TINYINT); _col0 ------- 123 (1 row)
- When an exponential expression is used, the string can be converted to the corresponding type.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot