This topic describes the syntax, description, parameters, and return values of numeric functions. This topic also provides examples of these functions.
add
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | add(n1, n2)
|
Description | Calculates the sum of two addends. |
Parameter |
|
Return value | Returns the sum of n1 + n2 .
|
Example | Output:n1=30 n2=-10 n3=200 n4=0.5 n5=15 |
sub
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | sub(n1, n2)
|
Description | Calculates the difference between two numbers. |
Parameter |
|
Return value | Returns the difference of n1 - n2 .
|
Example | Output:n1=30 n2=-10 n3=200 n4=0.5 n5=15 |
mul
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | mul(n1, n2)
|
Description | Calculates the product of two numbers. |
Parameter |
|
Return value | Returns the product of n1 × n2 .
|
Example | Output:n1=30 n2=-10 n3=200 n4=0.5 n5=15 |
div
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | div(n1, n2)
|
Description | Calculates the quotient of two numbers. |
Parameter |
|
Return value | Returns the quotient of n1/n2 .
|
Example | Output:n1=30 n2=-10 n3=200 n4=0.5 n5=15 |
mod
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | mod(n1, n2)
|
Description | Calculates the remainder after division of one number by another. |
Parameter |
|
Return value | Returns the remainder of n1 % n2 .
|
Example | Output:n1=30 n2=-10 n3=200 n4=0.5 n5=15 |
gt
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | gt(n1, n2)
|
Description | Determines whether a number is greater than another one. |
Parameter |
|
Return value | If n1 > n2 , true is returned. Otherwise, false is returned.
|
Example |
|
ge
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | ge(n1, n2)
|
Description | Determines whether a number is greater than or equal to another one. |
Parameter |
|
Return value | If n1 >= n2 , true is returned. Otherwise, false is returned.
|
Example |
|
lt
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | lt(n1, n2)
|
Description | Determines whether a number is smaller than another one. |
Parameter |
|
Return value | If n1 < n2 , true is returned. Otherwise, false is returned.
|
Example |
|
le
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | le(n1, n2)
|
Description | Determines whether a number is smaller than or equal to another one. |
Parameter |
|
Return value | if n1 <= n2 , true is returned. Otherwise, false is returned.
|
Example |
|
floor
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | floor(n)
|
Description | Generates the greatest integer that is smaller than or equal to a number. |
Parameter | n: the number to be rounded down. |
Return value | Returns the greatest integer that is smaller than or equal to the number specified
byn .
|
Example |
Request: /path1/path2/file?num=9.3 Response: ceil: 10 floor: 9. |
ceil
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | ceil(n)
|
Description | Generates the smallest integer that is greater than or equal to a number. |
Parameter | n: the number to be rounded up. |
Return value | Returns the smallest integer that is greater than or equal to the number specified
byn .
|
Example |
Request: /path1/path2/file?num=9.3 Response: ceil: 10 floor: 9. |