# Table interpolate linear

`table-interpolate-linear` · version 1.0.0 · CSV & tables · free, no key needed

Evaluate query x values in an x/y table and return once-rounded linear interpolation results.

**Use when you need to: interpolate function table x y · linear interpolation lookup table · evaluate values between table points.**

## Decide before calling

Read the [versioned contract](/v1/tools/table-interpolate-linear/versions/1.0.0) and the supported scope below. Reuse `table-interpolate-linear@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `table-interpolate-linear@1.0.0` for interpolate function table x y. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- interpolate function table x y
- linear interpolation lookup table
- evaluate values between table points
- piecewise linear table lookup
- clamp interpolation outside range
- linearly extrapolate table endpoints

## Not supported

- spline or polynomial interpolation
- tables with duplicate or unsorted x values

## Behavior

- Uses the bracketing segment formula y0 + (x-x0)*(y1-y0)/(x1-x0) with strictly increasing x.
- The explicit out_of_range policy is error, clamp, or linear extrapolation; exact rational results are rounded once.
- half_up rounds ties away from zero (for example, -2.5 rounds to -3 at zero decimal places).

## Input

- `x` (array of string or number, required): min items 2; max items 32
- `y` (array of string or number, required): min items 2; max items 32
- `query_x` (array of string or number, required): min items 1; max items 32
- `out_of_range` (one of "error", "clamp", "extrapolate", required)
- `decimal_places` (integer, required): min 0; max 18
- `rounding_mode` (one of "half_even", "half_up", "toward_zero", "toward_positive", "toward_negative", required)

## Output

- `results` (array of string, required)
- `standard_version` (constant "IEEE 754-2019 section 4.3", required)

## Limits

- max input bytes: 32768
- max items: 32
- max decimal chars: 70
- max total decimal chars: 1024
- max digits: 64
- max exponent magnitude: 100
- max decimal places: 18
- max iterations: 256
- max output bytes: 32768

## Example

Request input:

```json
{
  "x": [
    "0",
    "10"
  ],
  "y": [
    "0",
    "20"
  ],
  "query_x": [
    "2.5"
  ],
  "out_of_range": "error",
  "decimal_places": 2,
  "rounding_mode": "half_even"
}
```

Response:

```json
{
  "result": {
    "results": [
      "5.00"
    ],
    "standard_version": "IEEE 754-2019 section 4.3"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "table-interpolate-linear",
  "version": "1.0.0",
  "input": {
    "x": [
      "0",
      "10"
    ],
    "y": [
      "0",
      "20"
    ],
    "query_x": [
      "2.5"
    ],
    "out_of_range": "error",
    "decimal_places": 2,
    "rounding_mode": "half_even"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/table-interpolate-linear/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"x":["0","10"],"y":["0","20"],"query_x":["2.5"],"out_of_range":"error","decimal_places":2,"rounding_mode":"half_even"}'
```

The machine-readable contract is at [/v1/tools/table-interpolate-linear/versions/1.0.0](/v1/tools/table-interpolate-linear/versions/1.0.0).

### CLI

```sh
node cli.mjs run table-interpolate-linear 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Table count distinct check](/tools/table-count-distinct-check): Check a claimed COUNT(DISTINCT) and optional distinct-value list over JSON rows; returns the first mismatch.
- [Table reconciliation check](/tools/table-reconciliation-check): Check a claimed keyed reconciliation of two JSON tables and per-key statuses; report the first wrong key or count.
- [CSV clamp integer column](/tools/csv-clamp-integer-column): Clamp every data cell in a named CSV column to optional canonical integer min and max bounds.
- [CSV column compute](/tools/csv-column-compute): Appends an exact rounded arithmetic column to RFC 4180 CSV and returns the complete CSV.
- [CSV distinct values](/tools/csv-distinct-values): List distinct exact values of one CSV column in first-seen order.
- [CSV filter pattern literal](/tools/csv-filter-pattern-literal): Filter ASCII CSV with literal contains/starts-with; requires CRLF records, rejects LF-only and non-ASCII input.
