I'm trying to make this customRound func, but Xcode complaining that can not convert value of type () to Double
How could I possibly solve this problem?
extension Double {
func customRound(zeros: Int) -> Double {
return round(Double(zeros)*self) / Double(zeros)
}
}
update:
extension Double {
func customRound(digits: Int) -> Double {
return Darwin.round(pow(10.0, Double(digits))*self) / pow(10.0, Double(digits))
}
}