round method

TValue round(
  1. TUnit roundTo
)

Rounds this unit of measurement such that the roundTo unit will be rounded towards the nearest integer.

Implementation

TValue round(TUnit roundTo) {
  final units = getUnits(roundTo);
  final roundedUnits = units.round().toRational();
  final baseValue = getBaseValue(roundTo, roundedUnits);
  final result = createValue(baseValue);
  return result;
}