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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -