operator % method

Fixed operator %(
  1. Fixed denominator
)

Returns this % denominator.

The scale is the largest of the two scales.

Implementation

Fixed operator %(Fixed denominator) {
  final targetScale = max(scale, denominator.scale);

  final numerator =
      _rescale(minorUnits, existingScale: scale, targetScale: targetScale);
  final scaledDenominator = _rescale(denominator.minorUnits,
      existingScale: denominator.scale, targetScale: targetScale);

  return Fixed.fromBigInt(numerator % scaledDenominator, scale: targetScale);
}