InferenceNumericFormat.floatingPoint constructor

InferenceNumericFormat.floatingPoint({
  1. required int exponentWidth,
  2. required int mantissaWidth,
  3. int? productWidth,
  4. int? accumulatorWidth,
  5. NumericRoundingMode roundingMode = NumericRoundingMode.nearestEven,
  6. NumericOverflowMode overflowMode = NumericOverflowMode.saturate,
})

Creates a floating-point inference format.

Implementation

factory InferenceNumericFormat.floatingPoint({
  required int exponentWidth,
  required int mantissaWidth,
  int? productWidth,
  int? accumulatorWidth,
  NumericRoundingMode roundingMode = NumericRoundingMode.nearestEven,
  NumericOverflowMode overflowMode = NumericOverflowMode.saturate,
}) {
  final elementWidth = exponentWidth + mantissaWidth + 1;
  final resolvedProductWidth = productWidth ?? elementWidth;
  return InferenceNumericFormat(
    elementKind: InferenceElementKind.floatingPoint,
    elementWidth: elementWidth,
    productWidth: resolvedProductWidth,
    accumulatorWidth: accumulatorWidth ?? resolvedProductWidth,
    signed: true,
    exponentWidth: exponentWidth,
    mantissaWidth: mantissaWidth,
    roundingMode: roundingMode,
    overflowMode: overflowMode,
  );
}