multiply method

IntervalDomain multiply(
  1. IntervalDomain other
)

Implementation

IntervalDomain multiply(IntervalDomain other) {
  if (isBottom || other.isBottom) return bottomValue;

  // If either operand is top, result is top
  if (isTop || other.isTop) return topValue;

  // Handle infinity cases conservatively
  if (min == null || max == null || other.min == null || other.max == null) {
    return _multiplyWithInfinity(other);
  }

  // All bounds are finite - compute all corner products
  final products = <int>[
    min! * other.min!,
    min! * other.max!,
    max! * other.min!,
    max! * other.max!,
  ];

  return IntervalDomain(
    products.reduce(math.min),
    products.reduce(math.max),
  );
}