Mojo function
round
round[T: Roundable, //](number: T) -> $0
Get the rounded value of the given object.
Parameters:
- βT (
Roundable
): The type conforming to Roundable.
Args:
- βnumber (
T
): The object to get the rounded value of.
Returns:
The rounded value of the object.
round(number: FloatLiteral) -> FloatLiteral
Get the rounded value of the given FloatLiteral.
Args:
- βnumber (
FloatLiteral
): The FloatLiteral to get the rounded value of.
Returns:
The rounded value of the object.
round[T: Roundable, //](number: T, ndigits: Int) -> $0
Get the value of this object, rounded to a specified number of digits after the decimal point.
Parameters:
- βT (
Roundable
): The type conforming to Roundable.
Args:
- βnumber (
T
): The object to get the rounded value of. - βndigits (
Int
): The number of digits to round to.
Returns:
The rounded value of the object.
round(number: FloatLiteral, ndigits: Int) -> FloatLiteral
Get the value of this FloatLiteral, rounded to a specified number of digits after the decimal point.
Args:
- βnumber (
FloatLiteral
): The FloatLiteral to get the rounded value of. - βndigits (
Int
): The number of digits to round to.
Returns:
The rounded value of the object. Positive ndigits to the right of the decimal, negative ndigits to the left.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
π What went wrong?