Skip to content

Main content

Weighted Interval Gap Tool

Calculate weighted interval gap from explicit caller-supplied inputs.

Loading tool…

Description

gap = max(0,firstLower-secondUpper,secondLower-firstUpper); weightedGap = gap*weight.

Distances between intervals and bounds on metric distances describe geometric separation under declared assumptions. Touching intervals have zero gap; triangle bounds require distances that share a common endpoint in an actual metric.

gap = max(0,firstLower-secondUpper,secondLower-firstUpper); weightedGap = gap*weight.

When to use this tool

Use Weighted Interval Gap when checking a supplied interval gap or metric distance bound.

How to use the tool and how it works

  1. Enter firstLower, firstUpper, secondLower, secondUpper, weight. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read gap, weightedGap. Use the output convention below.

Require each interval ordered lower <= upper and nonnegative weight. gap = max(0,firstLower-secondUpper,secondLower-firstUpper); weightedGap = gap*weight.1

Input fieldMeaning and unitsAccepted input
firstLowerFirst LowerRequired. Finite number.
firstUpperFirst UpperRequired. Finite number.
secondLowerSecond LowerRequired. Finite number.
secondUpperSecond UpperRequired. Finite number.
weightWeightRequired. Finite number; minimum 0.
Output fieldInterpretationReturned shape
gapSigned difference from the stated reference, using compatible units.Required. Finite number.
weightedGapWeighted GapRequired. Finite number.
json
{
  "input": {
    "firstLower": 0,
    "firstUpper": 2,
    "secondLower": 5,
    "secondUpper": 8,
    "weight": 3
  },
  "output": {
    "gap": 3,
    "weightedGap": 9
  }
}

Limitations and assumptions

  • Intervals share a linear coordinate unit. Overlap and touching give zero; this is minimum separation, not Hausdorff distance or a probabilistic difference between uncertain quantities.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use the full point or set geometry and a suitable metric when you need an actual distance rather than a bound or local term.

References

  1. Calculation and input contract: distance/weighted-interval-gap — tool.io

Similar or alternative tools