How would you round up or down a Float to nearest even numbered integer in Swift 3? -
i need little rounding or down float nearest number in swift.
eg:
32.86 closest 32 33.86 closest 34
if want round nearest number, divide 2, round , multiply 2:
let rounded = int(round(value / 2.0)) * 2
Comments
Post a Comment