FixedPoint¶
- class FixedPoint(value, fractional_bits=28, bit_width=32)[source][source]¶
Bases:
objectFixed-point numeric type for QUA-compatible saturated arithmetic.
Values are stored as signed integers scaled by
2**fractional_bitswithin a configurable bit width.Create a fixed-point value from a float or integer scale.
- Parameters:
value – Initial value (float interpreted in fixed-point units).
fractional_bits – Number of fractional bits in the representation.
bit_width – Total signed bit width including the sign bit.
- classmethod from_int(int_value, fractional_bits=28, bit_width=32)[source][source]¶
Construct a
FixedPointfrom an integer fixed-point representation.- Parameters:
int_value – Scaled integer value (already in fixed-point units).
fractional_bits – Number of fractional bits.
bit_width – Total signed bit width.
- Returns:
New
FixedPointinstance.