Just support the compact precision decimal.
167264
public static void putDecimalNormalizedKey(
			Decimal record, MemorySegment target, int offset, int len) {
		assert record.getPrecision() <= Decimal.MAX_COMPACT_PRECISION;
		putLongNormalizedKey(record.toUnscaledLong(), target, offset, len);
	}
254831
def as_percent(precision=2, **kwargs):
    
    if not isinstance(precision, Integral):
        raise TypeError("Precision must be an integer.")

    return _surpress_formatting_errors(
        _format_numer(".{}%".format(precision))
    )
1162859
public static String compactDecimal(final Number value)
    {
        NumberFormat fmt = context.get().getCompactDecimalFormat();
        return fmt.format(value);
    }
901243
def truncate_to_string(num, precision=0):
        """"""
        if precision > 0:
            parts = ('{0:.%df}' % precision).format(Decimal(num)).split('.')
            decimal_digits = parts[1][:precision].rstrip('0')
            decimal_digits = decimal_digits if len(decimal_digits) else '0'
            return parts[0] + '.' + decimal_digits
        return ('%d' % num)
647152
public static Decimal sign(Decimal b0) {
		if (b0.isCompact()) {
			return new Decimal(b0.precision, b0.scale, b0.signum() * POW10[b0.scale], null);
		} else {
			return fromBigDecimal(BigDecimal.valueOf(b0.signum()), b0.precision, b0.scale);
		}
	}
500723
public Decimal floor() {
		BigDecimal bd = toBigDecimal().setScale(0, RoundingMode.FLOOR);
		return fromBigDecimal(bd, bd.precision(), 0);
	}
930097
public void reducePrecision(){
    if(_vals == null) return;
    for(int i = 0; i < _vals.length -_vals_dim /* do not reduce precision of NAs */; i+=_vals_dim) {
      _vals[i+1] = (float)_vals[i+1];
      _vals[i+2] = (float)_vals[i+2];
    }
  }
887742
def precision(value = nil, options = {})
      if value.nil?
        @precision
      elsif free?
        if is_exact?(value, options)
          0
        else
          num_digits(value, options)
        end
      else # fixed?
        if absolute?
          @places + num_integral_digits(value)
        else # relative?
          @precision
        end
      end
    end
780179
def prepare_bytes_decimal(data, schema):
    """"""
    if not isinstance(data, decimal.Decimal):
        return data
    scale = schema.get('scale', 0)

    # based on https://github.com/apache/avro/pull/82/

    sign, digits, exp = data.as_tuple()

    if -exp > scale:
        raise ValueError(
            'Scale provided in schema does not match the decimal')
    delta = exp + scale
    if delta > 0:
        digits = digits + (0,) * delta

    unscaled_datum = 0
    for digit in digits:
        unscaled_datum = (unscaled_datum * 10) + digit

    bits_req = unscaled_datum.bit_length() + 1

    if sign:
        unscaled_datum = (1 << bits_req) - unscaled_datum

    bytes_req = bits_req // 8
    padding_bits = ~((1 << bits_req) - 1) if sign else 0
    packed_bits = padding_bits | unscaled_datum

    bytes_req += 1 if (bytes_req << 3) < bits_req else 0

    tmp = MemoryIO()

    for index in range(bytes_req - 1, -1, -1):
        bits_to_write = packed_bits >> (8 * index)
        tmp.write(mk_bits(bits_to_write & 0xff))

    return tmp.getvalue()
1110069
def round_to_int(number, precision):
    """"""
    precision = int(precision)
    rounded = (int(number) + precision / 2) // precision * precision
    return rounded
1089943
public static float round(float f, int decimalPlace) {
      return BigDecimal.valueOf((double) f).setScale(decimalPlace, BigDecimal.ROUND_HALF_UP).floatValue();
   }
354658
def frange(start, stop, step, precision):
    """"""
    value = start
    while round(value, precision) < stop:
        yield round(value, precision)
        value += step
1231773
function(value, precision, base){
    var sizes =         ['Y','Z','E','P','T','G','M','k',''],
        fractionSizes = ['y','z','a','f','p','n','µ','m',''],
        total = sizes.length;

    base = base || 1000;
    precision = Math.pow(10, precision || 2);

    if (value === 0) return 0;

    if (value > 1) {
      while (total-- && (value >= base)) value /= base;
    }
    else {
      sizes = fractionSizes;
      total = sizes.length;
      while (total-- && (value < 1)) value *= base;
    }

    return (Math.round(value * precision) / precision) + sizes[total];
  }
41270
def _precision(self, value):
        
        value = str(value)
        decimal = value.rfind('.')
        if decimal == -1:
            return 0
        return len(value) - decimal - 1
664460
public static Decimal fromUnscaledBytes(int precision, int scale, byte[] bytes) {
		if (precision > MAX_COMPACT_PRECISION) {
			BigDecimal bd = new BigDecimal(new BigInteger(bytes), scale);
			return new Decimal(precision, scale, -1, bd);
		}
		assert bytes.length == 8;
		long l = 0;
		for (int i = 0; i < 8; i++) {
			l <<= 8;
			l |= (bytes[i] & (0xff));
		}
		return new Decimal(precision, scale, l, null);
	}
956252
private static void adjustForCurrencyDefaultFractionDigits(
            DecimalFormat format, DecimalFormatSymbols symbols) {
        Currency currency = symbols.getCurrency();
        if (currency == null) {
            try {
                currency = Currency.getInstance(symbols.getInternationalCurrencySymbol());
            } catch (IllegalArgumentException e) {
            }
        }
        if (currency != null) {
            int digits = currency.getDefaultFractionDigits();
            if (digits != -1) {
                int oldMinDigits = format.getMinimumFractionDigits();
                // Common patterns are "#.##", "#.00", "#".
                // Try to adjust all of them in a reasonable way.
                if (oldMinDigits == format.getMaximumFractionDigits()) {
                    format.setMinimumFractionDigits(digits);
                    format.setMaximumFractionDigits(digits);
                } else {
                    format.setMinimumFractionDigits(Math.min(digits, oldMinDigits));
                    format.setMaximumFractionDigits(digits);
                }
            }
        }
    }
1082016
public static function fromFloat($float_value, $precision = null)
    {
        if ($precision === null) {
            $precision = static::$PRECISION;
        }

        // left of decimal point
        $rounded_float = intval(round($float_value));
        $big_integer_int = (new BigInt($rounded_float))->multiply(self::precisionUnitsAsBigInt(1, $precision));

        // right of decimal point
        $rounded_decimal = intval(round(floatval($float_value - $rounded_float) * pow(10, $precision)));
        $big_integer_decimal = new BigInt($rounded_decimal);

        // add the integer value and the decimal value
        return new static($big_integer_int->add($big_integer_decimal), $precision);
    }