KassieZ commented on code in PR #1992: URL: https://github.com/apache/doris-website/pull/1992#discussion_r1947410589
########## docs/sql-manual/sql-functions/scalar-functions/numeric-functions/floor.md: ########## @@ -22,66 +22,101 @@ specific language governing permissions and limitations under the License. --> -## floor +## Description -### description -#### Syntax +Round down floating-point and fixed-point decimals to a specific number of digits and return the rounded floating-point or fixed-point number. -`T floor(T x[, d])` +## Syntax -If not specified `d`: returns the largest integer value less than or equal to `x`, which is **the most common usage**. -Otherwise, returns the largest round number that is less than or equal to `x` and flowing the rules: +```sql +floor(<a>, <d>) +``` + +## Parameters + +| Parameter | Description | +| -- | -- | +| `<a>` | Floating-point (Double) or fixed-point (Decimal) parameter indicating the parameter to be rounded | +| `<d>` | Optional, integer, indicates rounding to the target number of digits, a positive number means rounding to the next decimal point, a negative number means rounding to the next decimal point, and `0` indicates rounding to an integer. When not filled, it is equivalent to `<d> = 0`. | + +## Return Value + +Returns the largest rounded number less than or equal to `<a>` according to the following rules. + +Round to `1/(10^d)` digit, i.e., make the result divisible by `1/(10^d)`. If `1/(10^d)` is not exact, the rounding digit is the nearest number of the corresponding data type. -If `d` is specified as literal: -`d` = 0: just like without `d` -`d` > 0 or `d` < 0: the round number would be a multiple of `1/(10^d)`, or the nearest number of the appropriate data type if `1/(10^d)` isn't exact. +For an entry `<a>` of type Decimal, assuming it is of type `Decimal(p, s)`, the return value is: -Else if `d` is a column, and `x` has Decimal type, scale of result Decimal will always be same with input Decimal. +- `Decimal(p, 0)`,若 `<d> <= 0` Review Comment: 有中文出现 ########## versioned_docs/version-2.0/sql-manual/sql-functions/numeric-functions/floor.md: ########## @@ -22,40 +22,101 @@ specific language governing permissions and limitations under the License. --> -## floor - -### description -#### Syntax - -`BIGINT floor(DOUBLE x)` -Returns the largest integer value less than or equal to `x`. - -:::tip -Another alias for this function is `dfloor`. -::: - -### example - -``` -mysql> select floor(1); -+------------+ -| floor(1.0) | -+------------+ -| 1 | -+------------+ -mysql> select floor(2.4); -+------------+ -| floor(2.4) | -+------------+ -| 2 | -+------------+ -mysql> select floor(-10.3); -+--------------+ -| floor(-10.3) | -+--------------+ -| -11 | -+--------------+ -``` - -### keywords - FLOOR, DFLOOR +## Description + +Round down floating-point and fixed-point decimals to a specific number of digits and return the rounded floating-point or fixed-point number. + +## Syntax + +```sql +floor(<a>, <d>) +``` + +## Parameters + +| Parameter | Description | +| -- | -- | +| `<a>` | Floating-point (Double) or fixed-point (Decimal) parameter indicating the parameter to be rounded | +| `<d>` | Optional, integer, indicates rounding to the target number of digits, a positive number means rounding to the next decimal point, a negative number means rounding to the next decimal point, and `0` indicates rounding to an integer. When not filled, it is equivalent to `<d> = 0`. | + +## Return Value + +Returns the largest rounded number less than or equal to `<a>` according to the following rules. + +Round to `1/(10^d)` digit, i.e., make the result divisible by `1/(10^d)`. If `1/(10^d)` is not exact, the rounding digit is the nearest number of the corresponding data type. + +For an entry `<a>` of type Decimal, assuming it is of type `Decimal(p, s)`, the return value is: + +- `Decimal(p, 0)`,若 `<d> <= 0` Review Comment: 有中文出现,2.1/3.0 同样的问题 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
