InferenceNumericFormat.fixedPoint constructor
- required bool signed,
- required int integerWidth,
- required int fractionWidth,
- int? productWidth,
- int? accumulatorWidth,
- NumericRoundingMode roundingMode = NumericRoundingMode.nearestEven,
- NumericOverflowMode overflowMode = NumericOverflowMode.saturate,
Creates a fixed-point inference format.
Implementation
factory InferenceNumericFormat.fixedPoint({
required bool signed,
required int integerWidth,
required int fractionWidth,
int? productWidth,
int? accumulatorWidth,
NumericRoundingMode roundingMode = NumericRoundingMode.nearestEven,
NumericOverflowMode overflowMode = NumericOverflowMode.saturate,
}) {
final elementWidth = integerWidth + fractionWidth + (signed ? 1 : 0);
final resolvedProductWidth = productWidth ?? elementWidth * 2;
return InferenceNumericFormat(
elementKind: InferenceElementKind.fixedPoint,
elementWidth: elementWidth,
productWidth: resolvedProductWidth,
accumulatorWidth: accumulatorWidth ?? resolvedProductWidth,
signed: signed,
integerWidth: integerWidth,
fractionWidth: fractionWidth,
roundingMode: roundingMode,
overflowMode: overflowMode,
);
}