Returns this value rounded to an integral value using the specified rounding rule.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Parameters
rule
The rounding rule to use.
Return Value
The integral value found by rounding using rule
.
Discussion
The following example rounds a value using four different rounding rules:
For more information about the available rounding rules, see the Floating
enumeration. To round a value using the default “schoolbook rounding”, you can use the shorter rounded()
method instead.