Description
Subtract anchor from index using exact integers and return decimal distance plus a separate sign comparison.
An index map tracks where one item lands after a structural list operation. Zero-based element positions differ from boundary cursors, and missing destinations need a sentinel.
Subtract anchor from index using exact integers and return decimal distance plus a separate sign comparison.
When to use this tool
Use List Anchor Relative Index Sign when you need one item's position under an explicit list transformation.
How to use the tool and how it works
- Enter index, anchor. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read distanceDecimal, sign. Use the output convention below.
Subtract anchor from index using exact integers and return decimal distance plus a separate sign comparison.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| index | Zero-based position or diagnostic index under the calculation above; inspect any sentinel policy. | Required. Safe integer. |
| anchor | Anchor | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| distanceDecimal | Distance Decimal | Required. Text; maximum UTF-16 length 8192. |
| sign | Sign | Required. Safe integer. |
{
"input": {
"index": 12,
"anchor": 10
},
"output": {
"distanceDecimal": "2",
"sign": 1
}
} Limitations and assumptions
- The coordinates are supplied integers; no list bounds or indexing origin are inferred.
- 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
Apply the operation to a small representative list when checking a consuming language's indexing and slicing semantics.
References
Similar or alternative tools
- List Index Distance From End
For one-based positions return length minus index; for zero-based positions return length minus one minus index.
- Cyclic List Phase Remainder
Subtract origin from index using exact integers and reduce modulo positive length into phase in [0, length).