bround
The bround function is used to return a value that is the result of rounding the input to the specified number of decimal places d using banker's rounding.
Syntax
bround(DOUBLE a, INT d)
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. Represents the value to be rounded. The difference between this command and traditional rounding is in the handling of the digit 5: the preceding digit determines the rounding. If the preceding digit is odd, it rounds up. If the preceding digit is even, it rounds down. If parameter a is not of type DOUBLE, it is implicitly converted to DOUBLE type before evaluation. |
| d | No | DOUBLE, BIGINT, DECIMAL, or STRING | Represents the number of decimal places to round to. If parameter d is not of type INT, it is implicitly converted to INT type before evaluation. |
Return Values
Returns a value of type DOUBLE.
If a or d is NULL, NULL is returned.
Example Code
Returns 123.4.
select bround(123.45,1);
Returns 123.6.
select bround(123.55,1);
Returns NULL.
select bround(null);
Returns 123.457.
select bround(123.456789,3.123456);
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