abs()
Returns the absolute value of a given number.
Syntax | abs(<num>) |
||
Arguments | Name | Type | Description |
<num> |
Numeric | The target number | |
Return Type | UINT |
return abs(-2.32)
Result:
abs(-2.32) |
---|
2.32 |
ceil()
Rounds a given number up to the nearest integer.
Syntax | ceil(<num>) |
||
Arguments | Name | Type | Description |
<num> |
Numeric | The target number | |
Return Type | INT |
uncollect [-2.92, 4.2] as item
return ceil(item)
Result:
ceil(item) |
---|
-2 |
5 |
floor()
Rounds a given number down to the nearest integer.
Syntax | floor(<num>) |
||
Arguments | Name | Type | Description |
<num> |
Numeric | The target number | |
Return Type | INT |
uncollect [-2.92, 4.2] as item
return floor(item)
Result:
floor(item) |
---|
-3 |
4 |
pi()
Returns the mathematical constant π (pi) approximately equal to 3.14159. Pi is the ratio of a circle's circumference to its diameter in Euclidean geometry.
Syntax | pi() |
Return Type | DOUBLE |
return pi()
Result:
pi() |
---|
3.14159265358979 |
pow()
Raises a number to the power of another number.
Syntax | power(<base>, <exponent>) |
||
Arguments | Name | Type | Description |
<base> |
Numeric | The number to be raised to a power | |
<exponent> |
Numeric | The power to which the base is raised | |
Return Type | DOUBLE |
return pow(2, 4)
Result:
pow(2, 4) |
---|
16 |
round()
Returns the nearest value of a given number, rounded to a specified position of digits. If two nearest values are equidistant, it returns the one with the larger absolute value.
Syntax | round(<num>, [<digit>]) |
||
Arguments | Name | Type | Description |
<num> |
Numeric | The target number to be rounded | |
<digit> |
INT |
The position of digits to keep:
|
|
Return Type | DOUBLE |
return round(3.1415926, 3)
Result:
round(3.1415926, 3) |
---|
3.142 |
sqrt()
Computes the square root of a given number.
Syntax | sqrt(<num>) |
||
Arguments | Name | Type | Description |
<num> |
Numeric | The target number | |
Return Type | DOUBLE |
return sqrt(16)
Result:
sqrt(16) |
---|
4 |