Often I have to use floating point numbers with integers. For example:
var percent:Float = 0.6347
var wholeValue:Int = 10
var result = Int(Float(wholeValue) * percent)
I have to convert the integer wholeValue
to a Float
, apply the operation, then convert the results back to Int
. This is really clunky and tedious. Is there a better way to operate on Ints with Floats?