max_precision_for_fixed_bytes

Function max_precision_for_fixed_bytes 

Source
const fn max_precision_for_fixed_bytes(n: usize) -> Option<usize>
Expand description

Compute the exact maximum base‑10 precision that fits in n bytes for Avro fixed decimals stored as two’s‑complement unscaled integers (big‑endian).

Per Avro spec (Decimal logical type), for a fixed length n: max precision = ⌊log₁₀(2^(8n − 1) − 1)⌋.

This function returns None if n is 0 or greater than 32 (Arrow supports Decimal256, which is 32 bytes and has max precision 76).