Answers for "round double swift 5"

5

format decimal place swift

let tip: Double = 15.2847320
let tipText: String = String(format: "%.2f", tip)
// %.2f for two decimal places
Posted by: Guest on March-14-2020
5

round up swift

let number = 0.1
// Use ceil to remove the fractional part and round up.
let result = ceil(number)


let number1 = 1.1
// Use floor to remove the fractional part and round down.
let floor1 = floor(number1)
Posted by: Guest on June-19-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language