pub fn numeric_to_twos_complement_wide(
    numeric: Numeric,
) -> [u8; NumericAgg::TWOS_COMPLEMENT_BYTE_WIDTH] {
    let mut buf = [0; NumericAgg::TWOS_COMPLEMENT_BYTE_WIDTH];
    // Avro doesn't specify how to handle NaN/infinity, so we simply treat them
    // as zeroes so as to avoid erroring (encoding values is meant to be
    // infallible) and retain downstream associativity/commutativity.
    if numeric.is_special() {
        return buf;
    }
    let mut cx = NumericAgg::context();
    let mut d = cx.to_width(numeric);
    let mut scaler = NumericAgg::from(NUMERIC_DATUM_MAX_PRECISION);
    cx.neg(&mut scaler);
    // Shape `d` so that its exponent is -NUMERIC_DATUM_MAX_PRECISION
    cx.rescale(&mut d, &scaler);
    // Adjust `d` so it is a canonical coefficient, i.e. its exact value can be
    // recovered by setting its exponent to -39.
    cx.abs(&mut scaler);
    cx.scaleb(&mut d, &scaler);

    numeric_to_twos_complement_inner::<NumericAgg, NUMERIC_AGG_WIDTH>(d, &mut cx, &mut buf);
    buf
}
/// Converts an [`Numeric`] into a big endian two's complement representation where
/// the encoded value has [`NUMERIC_AGG_MAX_PRECISION`] digits and a scale of
/// [`NUMERIC_DATUM_MAX_PRECISION`].
///
/// This representation is appropriate to use in
/// contexts requiring two's complement representation but `Numeric` values' scale
/// isn't known, e.g. when working with columns with an explicitly defined
/// scale.


This representation is appropriate to use in
contexts requiring two's complement representation but `Numeric` values' scale
isn't known, e.g. when working with columns with an explicitly defined
scale.
This representation is appropriate to use in contexts requiring two ' s complement representation but ` Numeric ` values ' scale isn ' t known e . g . when working with columns with an explicitly defined scale .
pub fn numeric_to_twos_complement_wide(
    numeric: Numeric,
) -> [u8; NumericAgg::TWOS_COMPLEMENT_BYTE_WIDTH] {
    let mut buf = [0; NumericAgg::TWOS_COMPLEMENT_BYTE_WIDTH];
    // Avro doesn't specify how to handle NaN/infinity, so we simply treat them
    // as zeroes so as to avoid erroring (encoding values is meant to be
    // infallible) and retain downstream associativity/commutativity.
    if numeric.is_special() {
        return buf;
    }
    let mut cx = NumericAgg::context();
    let mut d = cx.to_width(numeric);
    let mut scaler = NumericAgg::from(NUMERIC_DATUM_MAX_PRECISION);
    cx.neg(&mut scaler);
    // Shape `d` so that its exponent is -NUMERIC_DATUM_MAX_PRECISION
    cx.rescale(&mut d, &scaler);
    // Adjust `d` so it is a canonical coefficient, i.e. its exact value can be
    // recovered by setting its exponent to -39.
    cx.abs(&mut scaler);
    cx.scaleb(&mut d, &scaler);
    numeric_to_twos_complement_inner::<NumericAgg, NUMERIC_AGG_WIDTH>(d, &mut cx, &mut buf);
    buf
}
pub fn numeric_to_twos_complement_wide ( numeric : Numeric , ) -> [ u8 ; NumericAgg :: TWOS_COMPLEMENT_BYTE_WIDTH ] { let mut buf = [ 0 ; NumericAgg :: TWOS_COMPLEMENT_BYTE_WIDTH ] ; // Avro doesn't specify how to handle NaN/infinity, so we simply treat them // as zeroes so as to avoid erroring (encoding values is meant to be // infallible) and retain downstream associativity/commutativity. if numeric . is_special ( ) { return buf ; } let mut cx = NumericAgg :: context ( ) ; let mut d = cx . to_width ( numeric ) ; let mut scaler = NumericAgg :: from ( NUMERIC_DATUM_MAX_PRECISION ) ; cx . neg ( & mut scaler ) ; // Shape `d` so that its exponent is -NUMERIC_DATUM_MAX_PRECISION cx . rescale ( & mut d , & scaler ) ; // Adjust `d` so it is a canonical coefficient, i.e. its exact value can be // recovered by setting its exponent to -39. cx . abs ( & mut scaler ) ; cx . scaleb ( & mut d , & scaler ) ; numeric_to_twos_complement_inner :: < NumericAgg , NUMERIC_AGG_WIDTH > ( d , & mut cx , & mut buf ) ; buf }
Converts an [`Numeric`] into a big endian two's complement representation where
the encoded value has [`NUMERIC_AGG_MAX_PRECISION`] digits and a scale of
[`NUMERIC_DATUM_MAX_PRECISION`].
Converts an [ ` Numeric ` ] into a big endian two ' s complement representation where the encoded value has [ ` NUMERIC_AGG_MAX_PRECISION ` ] digits and a scale of [ ` NUMERIC_DATUM_MAX_PRECISION ` ] .
numeric
Numeric
numeric
Numeric