Expand description
Functions related to Materialize’s numeric type, which is largely a wrapper
around rust-dec
.
Macros
Structs
The error returned when constructing a
NumericMaxScale
from an invalid
value.The
max_scale
of a ScalarType::Numeric
.Helper struct for representing
Option<NumericMaxScale>
.Constants
The maximum number of digits expressable in a
NumericAgg
value.The number of internal decimal units in a
NumericAgg
value.The value of
NUMERIC_AGG_WIDTH
as a u8
.The maximum number of digits expressable in a
Numeric
value.The number of internal decimal units in a
Numeric
value.The value of
NUMERIC_DATUM_WIDTH
as a u8
.Statics
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.
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
A numeric value.
A double-width version of
Numeric
for use in aggregations.