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
- Enter firstLower, firstUpper, secondLower, secondUpper, weight. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| firstLower | First Lower | Required. Finite number. |
| firstUpper | First Upper | Required. Finite number. |
| secondLower | Second Lower | Required. Finite number. |
| secondUpper | Second Upper | Required. Finite number. |
| weight | Weight | Required. Finite number; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| gap | Signed difference from the stated reference, using compatible units. | Required. Finite number. |
| weightedGap | Weighted Gap | Required. Finite number. |
{
"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
Similar or alternative tools
- Triangle Reverse Inequality Distance Bound
minimum = abs(left-right); maximum = left+right.
- Weighted Absolute Gap Term
contribution = abs(first-second)*weight.