code: public T mod(T modulus) {
          if (modulus == null) {
              throw new IllegalArgumentException("invalid (null) modulus");
          }
          double difference = this.value.doubleValue() % modulus.doubleValue();
          return newInstance(BigDecimal.valueOf(difference), this.value.scale());
      }
docs: This method calculates the mod between to T values by first casting to
  doubles and then by performing the % operation on the two primitives.
  
  @param modulus
  The other value to apply the mod to.
  @return result of performing the mod calculation
  @throws IllegalArgumentException if the given modulus is null