Skip to main content

Crate ancdec

Crate ancdec 

Source
Expand description

A #![no_std] fixed-point decimal library with four types for different precision/size needs.

TypeInteger/FracScaleSize
AncDec8u80-24 bytes
AncDec32u320-912 bytes
AncDecu640-1924 bytes
AncDec128u1280-3840 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-based Serialize/Deserialize
  • sqlx – PostgreSQL NUMERIC support (implies std + 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§

ParseError
Error returned when parsing a string into a decimal type fails.
RoundMode
Rounding modes for decimal operations.