
extension CGFloat {
    
    /// Round the number to the given amount of decimal places.
    func rounded(toPlaces places:Int) -> CGFloat {
        let divisor = pow(10.0, CGFloat(places))
        return (self * divisor).rounded() / divisor
    }
}
