# Temperature compare

`temperature-compare` · version 1.0.0 · Units & sizes · free, no key needed

Compare two temperatures in C, F, or K by converting both to Kelvin rationals.

**Use when you need to: temperature compare · compare temperatures across units · order celsius fahrenheit kelvin.**

## Supported

- temperature compare
- compare temperatures across units
- order celsius fahrenheit kelvin

## Not supported

- average temperatures
- sort a temperature list
- Rankine
- IEEE-754 floats

## Behavior

- left and right are objects with a canonical decimal value and a unit of C, F, or K.
- Both readings are converted to Kelvin with K = C + 5463/20 and F = C * 9/5 + 32.
- Temperatures below absolute zero (K < 0) are rejected.
- cmp is -1, 0, or 1 for left <, =, or > right after the Kelvin conversion.

## Input

- `left` (object, required)
- `right` (object, required)

## Output

- `cmp` (one of -1, 0, 1, required)

## Limits

- max digits before point: 20
- max fractional digits: 10

## Example

Request input:

```json
{
  "left": {
    "value": "0",
    "unit": "C"
  },
  "right": {
    "value": "32",
    "unit": "F"
  }
}
```

Response:

```json
{
  "result": {
    "cmp": 0
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "temperature-compare",
  "version": "1.0.0",
  "input": {
    "left": {
      "value": "0",
      "unit": "C"
    },
    "right": {
      "value": "32",
      "unit": "F"
    }
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/temperature-compare/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"left":{"value":"0","unit":"C"},"right":{"value":"32","unit":"F"}}'
```

The machine-readable contract is at [/v1/tools/temperature-compare/versions/1.0.0](/v1/tools/temperature-compare/versions/1.0.0).

### CLI

```sh
node cli.mjs run temperature-compare 1.0.0 --input input.json --base-url https://computefirst.net
```

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

## Related tools

- [Temperature convert](/tools/temperature-convert): Convert a decimal temperature between Celsius, Fahrenheit, and Kelvin as an exact rational.
- [Byte size compare](/tools/bytesize-compare): Compare two non-negative integer byte sizes by exact byte amounts.
- [Byte size convert](/tools/bytesize-convert): Convert a non-negative integer byte size between IEC binary units as an exact rational.
- [Length compare](/tools/length-compare): Compare two integer length measurements by exact nanometer amounts.
- [Length convert](/tools/length-convert): Convert a canonical integer length between exact SI and international customary units.
- [Mass add](/tools/mass-add): Add mixed-unit canonical integer mass amounts and express the sum in a target unit as a reduced rational.
