toNearest

infix fun <T : Units> Measure<T>.toNearest(value: Measure<T>): Measure<T>(source)

Returns a Measure that is rounded to he closest multiple of toNearest, and has the the units of toNearest.

val length = 25 * inches

length toNearest 1 * feet // 2.0 feet
length toNearest 0.1 * meters // 0.6 m