Decimal
Library of functions for the decimal type.
Functions
From
Builds a decimal from a number or string.
Syntax:
Decimal.From(str: number or string)
Parameters
str
: The value to convert to decimal.
Example:
Decimal.From(1) // 1.0
Decimal.From("1") // 1.0
Decimal.From(1.5) // 1.5
Round
Rounds a decimal to the specified number of decimal places.
Syntax:
Decimal.Round(value: decimal, decimal cases: int)
Parameters
value
: The value to be round.
decimal cases
: Number of decimal places to round to.
Example:
Round(2.1234, 2) // 2.12
Round(2.1234, 3) // 2.123