operator - method

Fixed operator -(
  1. Fixed subtration
)

Returns this - subtration

The scale is the largest of the two scales.

Implementation

Fixed operator -(Fixed subtration) {
  final targetScale = max(scale, subtration.scale);

  final scaledThis =
      _rescale(minorUnits, existingScale: scale, targetScale: targetScale);
  final scaledSubtraction = _rescale(subtration.minorUnits,
      existingScale: subtration.scale, targetScale: targetScale);

  return Fixed.fromBigInt(scaledThis - scaledSubtraction, scale: targetScale);
}