Tuesday, 15 June 2010

types - Basic math in Swift -



types - Basic math in Swift -

why have these conversions between types? thought smart programming language these conversions done automatically. there missing?

let time: float = 55.3 allow min = int(floor(cdouble(time))); allow sec = int(round(cdouble( (time - float(min)) * 60.0 )))

who says have to? works fine (xcode 6 dp2 playground):

import foundation allow time = 55.3 allow min = floor(time); allow sec = round((time - min) * 60.0)

math types swift

No comments:

Post a Comment