Functions -
lang.decimal
abs | IEEE abs operation. |
ceiling | Smallest (closest to -∞) floating point value not less than |
floor | Largest (closest to +∞) floating point value not greater than |
fromString | Return the decimal value represented by
|
max | Maximum of all the arguments. |
min | Minimum of all the arguments. |
round | Floating point value that is a mathematical integer and closest to |
sum | Sum of all the arguments. 0 if no args. |
IEEE abs operation.
Parameters
- x decimal
-
whose absolute value is to be determined
-
Return Type
(decimal) absolute value of the argument
Smallest (closest to -∞) floating point value not less than x
that is a mathematical integer
Parameters
- x decimal
-
value to performe ceiling on
-
Return Type
(decimal) integer ceiling value of the argument in decimal
Largest (closest to +∞) floating point value not greater than x
that is a mathematical integer.
Parameters
- x decimal
-
whose value to be floored
-
Return Type
(decimal) floored value
Return the decimal value represented by s
.
s
must follow the syntax of DecimalFloatingPointNumber as defined by the Ballerina specification
with the following modifications
- the DecimalFloatingPointLiteral may have a leading
+
or-
sign - a FloatingPointTypeSuffix is not allowed
This is the inverse of
value:toString
applied to andecimal
.
Parameters
- s string
-
string representation of a decimal
Maximum of all the arguments.
Parameters
- x decimal
-
first paramter to check for max value
- xs decimal[]
-
rest of the parameter to check for max value
-
Return Type
(decimal) maximum value of all provided values
Minimum of all the arguments.
Parameters
- x decimal
-
first paramter to check for min value
- xs decimal[]
-
rest of the parameter to check for min value
-
Return Type
(decimal) minimum value of all provided values
Floating point value that is a mathematical integer and closest to x
.
If there are two such integers, choose the one that is even
(this is the round-to-nearest rounding mode, which is the default for IEEE
and for Ballerina).
Same as Java Math.rint method
Same as .NET Math.Round method
IEEE 754 roundToIntegralTiesToEven operation
Note that <int>x
is the same as <int>x.round()
Parameters
- x decimal
-
whose value to be rounded
-
Return Type
(decimal) rounded value