Use scaling and bias to represent large ranges
developThe Fxp class supports a linear transformation via scale and bias. This allows you to represent a wide range of numbers using fewer bits by 'scaling down' the raw fractional value during input and 'scaling up' during output/operations.
Formula: Stored Value = (Actual Value - bias) / scale (conceptually applied during input/output).
This is useful when your data resides in a specific range (e.g., [10000, 12000]) and you want to avoid using massive bit-widths to represent the offset.
# Representing numbers in range [10000, 12000] with 0.5 precision
# using only 12 bits
x = Fxp(10128.5, signed=False, n_word=12, scale=1, bias=10000)
# Check the scaling configuration
x.info(3)