Expand description
A #![no_std] fixed-point decimal library with four types for different precision/size needs.
| Type | Integer/Frac | Scale | Size |
|---|---|---|---|
AncDec8 | u8 | 0-2 | 4 bytes |
AncDec32 | u32 | 0-9 | 12 bytes |
AncDec | u64 | 0-19 | 24 bytes |
AncDec128 | u128 | 0-38 | 40 bytes |
All types store integer and fractional parts separately with an explicit scale, avoiding the precision loss inherent in floating-point representations.
§Feature flags
dec8/dec32/dec64/dec128– enable individual types (all on by default)serde– string-basedSerialize/Deserializesqlx– PostgreSQLNUMERICsupport (impliesstd+dec64)
Structs§
- AncDec
- 64-bit fixed-point decimal (u64 int/frac, 19-digit precision, 24 bytes).
- AncDec8
- 8-bit fixed-point decimal (u8 int/frac, 2-digit precision, 4 bytes).
- AncDec32
- 32-bit fixed-point decimal (u32 int/frac, 9-digit precision, 12 bytes).
- AncDec128
- 128-bit fixed-point decimal (u128 int/frac, 38-digit precision, 40 bytes).
Enums§
- Parse
Error - Error returned when parsing a string into a decimal type fails.
- Round
Mode - Rounding modes for decimal operations.