Programming/Swift
round number to 2 decimal places
Sunny2014
2021. 1. 13. 22:28
let currentRatio = Double (rxCurrentTextField.text!)! / Double (txCurrentTextField.text!)! railRatioLabelField.text! = String(format: "%.2f", currentRatio)
Round up double to 2 decimal places
How do I round up currentRatio to two decimal places? let currentRatio = Double (rxCurrentTextField.text!)! / Double (txCurrentTextField.text!)! railRatioLabelField.text! = "\(currentRatio)"
stackoverflow.com