Parameters, Value
Round function returns the nearest integer to a certain numeric value; when there are two nearest integers, takes the larger one (needs to specify decimal places V4.1 , i.e. precision). In V4.1, the corresponding relation between decimal places and specified number of decimal places is as follows:
Decimal Places | ... | hundred's digit | ten's digit | unit's digit | digit with 1 decimal place | digit with 2 decimal places | ... |
---|---|---|---|---|---|---|---|
Numbers of Decimal Places | ... | -2 | -1 | 0 | 1 | 2 | ... |
Syntax:
- V4.0 Format: round(
<raw>
) - V4.1 Format: round(
<raw>
,<decimal_places>
) - Parameters: see table below
- Value: ATTR (number)
Name | Category | Specification | Description |
---|---|---|---|
raw | ATTR(number) | / | the numeric value to be calculated |
decimal_places V4.1 | int | Not mandatory, = 0 by default | Number of decimal places,only V4.1 supports this parameter |
Common Usage
Example: round -25.5 with 1 decimal place
return round(-25.5)
Example (V4.1): find 10 cards whose balances are over 500,000, round their balance to -4 decimal place
find().nodes({@card.balance >= 500000}) as n
limit 10
return round(n.balance, -4)