rangeProbability function

double rangeProbability(
  1. PricerInputs inputs,
  2. double lower,
  3. double higher
)

Probability mass in (lower, higher], floored at 0 (matches compute_range_price's saturating subtraction). Use lower <= 0 for the −∞ bound and higher = double.infinity for +∞.

Implementation

double rangeProbability(PricerInputs inputs, double lower, double higher) {
  // up(lower) − up(higher), where up(+inf) = 0 and up(<= 0) = 1.
  final upLower = lower <= 0 ? 1.0 : upProbability(inputs, lower);
  final upHigher =
      higher == double.infinity ? 0.0 : upProbability(inputs, higher);
  final d = upLower - upHigher;
  return d < 0 ? 0 : d;
}