# compareTo method

1. @override

int compareTo(

1. BigDecimal other

)
override

Compares this BigDecimal with another.

## Implementation

    @override
    int compareTo(BigDecimal other) {
      int maxScale = _scale > other._scale ? _scale : other._scale;
      BigDecimal a = setScale(maxScale);
      BigDecimal b = other.setScale(maxScale);

      return a._unscaledValue.compareTo(b._unscaledValue);
    }