Module repr::adt::numeric[][src]

Expand description

Functions related to Materialize’s numeric type, which is largely a wrapper around rust-dec.

Structs

Constants

The maximum number of digits expressable in a numeric.

Traits

Traits to generalize converting Decimal values to and from their coefficients’ two’s complements.

A type that can represent Real Numbers. Useful for interoperability between Numeric and floating point.

Functions

Returns a new context appropriate for operating on numeric aggregates.

Returns a new context appropriate for operating on numeric datums.

Validates the typ_mod is valid for numeric type and returns a specified scale is appropriate (we ignore the specified precision).

Returns n’s precision, i.e. the total number of digits represented by n in standard notation not including a zero in the “one’s place” in (-1,1).

Returns n’s scale, i.e. the number of digits used after the decimal point.

Ensures Numeric values are:

Using negative binary numbers can require more digits of precision than Numeric offers, so we need to have the option to swap bytes’ signs at the byte- rather than the library-level.

Converts an Numeric into its big endian two’s complement representation.

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.

Rescale n as an OrderedDecimal with the described scale, or error if:

Rescale’s n to fit within Numeric’s max precision or error if not possible.

Parses a buffer of two’s complement digits in big-endian order and converts them to Decimal<N>.

Type Definitions