[swift] Mathematical functions in Swift