to Nearest
Returns a Measure that is rounded to the closest multiple of value, and has the units of value.
val length = 25 * inches
length toNearest 1 * feet // 2.0 feet
length toNearest 0.1 * meters // 0.6 mContent copied to clipboard
Returns a Measure that is rounded to the closest multiple of value, and has the same units.
val length = 25.45 * inches
length toNearest 1 // 25.0 inches
length toNearest 0.1 // 25.5 inchesContent copied to clipboard