log2
The log2 function is used to return the base-2 logarithm of the given numeric value.
Syntax
log2(DOUBLE a)
Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| a | Yes | DOUBLE, BIGINT, DECIMAL, or STRING | The format of parameter a includes floating-point format, integer format, and string format. If parameter a is not of type DOUBLE, it is implicitly converted to DOUBLE type before evaluation. |
Return Values
Returns a value of type DOUBLE.
If a is 0, negative, or NULL, NULL is returned.
Example Code
Returns NULL.
select log2(null);
Returns NULL.
select log2(0);
Returns 3.1699250014423126.
select log2(9);
Returns 4.
select log2(16);
What is your overall rating for this page?
Thank 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