Unit conversion trace check
unit-conversion-trace-check · version 1.0.0 · Numbers & math · free, no key needed
Check a multi-step unit conversion trace with exact arithmetic; reports the first wrong step and its exact value
Use when you need to: check unit conversion steps · verify multi step unit conversion · find wrong step in unit conversion.
Decide before calling
Read the versioned contract and the supported scope below. Reuse unit-conversion-trace-check@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 unit-conversion-trace-check@1.0.0 for check unit conversion steps. 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
- check unit conversion steps
- verify multi step unit conversion
- find wrong step in unit conversion
- check dimensional analysis trace
- validate chained unit conversions
- verify worked unit conversion
- check show your work unit conversion
Not supported
- a built-in unit catalog (every unit is defined by the caller)
- steps that multiply by other quantities (only unit changes of one quantity)
- floating-point tolerances (rounding must be declared per step)
- logarithmic or irrational conversions
Behavior
- units: caller-defined catalog {symbol, dimension (7 integers L, M, T, I, Theta, N, J), factor > 0, offset}, value_SI = value x factor + offset; numbers are exact strings (integer, decimal or p/q, at most 60 characters).
- Order: start_unit terms known, then its affine rule; then each step in order: to_unit terms known (unknown_unit), affine rule (invalid_affine_composition), same dimension as the current unit (dimension_mismatch), value (value_mismatch with expected = the exact or rounded value, actual = the claim, both canonical).
- Step value: v_B = (v x F(A) + O(A) - O(B)) / F(B) for quantity_kind "absolute" (O = offset of a sole affine term, which must have power 1), offsets ignored for "interval"; when round_places is not null the value is rounded to that many decimal places, half to even. The claim must equal it exactly; the next step starts from the claimed value, so a trace may round intermediates exactly as written.
- steps_checked counts the steps that passed; final_value is the last claimed value in canonical exact form when every step passes, otherwise null.
- Structural problems throw invalid_input; more than 200 units, 50 steps, 8 terms, |power| 6, 30 round places, 60-character numbers or a 4000-digit exact intermediate throws limit_exceeded.
- Reference: JCGM 200:2012 (VIM) 1.24 and SI Brochure 9th ed. (2019) 2.3.4, 5.4; reference_version "jcgm-200-2012-vim3-si-brochure-9e-2019".
Input
units(array of object, required): min items 1; max items 200quantity_kind(one of "absolute", "interval", required)start_value(string, required): min length 1; max length 60; pattern^-?(0|[1-9][0-9]*)(\.[0-9]+|/[1-9][0-9]*)?$start_unit(array of object, required): max items 8steps(array of object, required): min items 1; max items 50
Output
valid(boolean, required)reason(one of null, "unknown_unit", "invalid_affine_composition", "dimension_mismatch", "value_mismatch", required)first_discrepancy(object or null, required)steps_checked(integer, required): min 0; max 50final_value(string or null, required)reference_version(constant "jcgm-200-2012-vim3-si-brochure-9e-2019", required)
Limits
- max units: 200
- max symbol bytes: 32
- max terms: 8
- max abs power: 6
- max number chars: 60
- max exact digits: 4000
- max steps: 50
- max round places: 30
Example
Request input:
{
"units": [
{
"symbol": "m",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "1",
"offset": "0"
},
{
"symbol": "mi",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "1609.344",
"offset": "0"
},
{
"symbol": "s",
"dimension": [
0,
0,
1,
0,
0,
0,
0
],
"factor": "1",
"offset": "0"
},
{
"symbol": "h",
"dimension": [
0,
0,
1,
0,
0,
0,
0
],
"factor": "3600",
"offset": "0"
}
],
"quantity_kind": "absolute",
"start_value": "60",
"start_unit": [
{
"unit": "mi",
"power": 1
},
{
"unit": "h",
"power": -1
}
],
"steps": [
{
"to_unit": [
{
"unit": "m",
"power": 1
},
{
"unit": "h",
"power": -1
}
],
"claimed_value": "96560.64",
"round_places": null
},
{
"to_unit": [
{
"unit": "m",
"power": 1
},
{
"unit": "s",
"power": -1
}
],
"claimed_value": "26.82",
"round_places": 2
}
]
}
Response:
{
"result": {
"valid": true,
"reason": null,
"first_discrepancy": null,
"steps_checked": 2,
"final_value": "26.82",
"reference_version": "jcgm-200-2012-vim3-si-brochure-9e-2019"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "unit-conversion-trace-check",
"version": "1.0.0",
"input": {
"units": [
{
"symbol": "m",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "1",
"offset": "0"
},
{
"symbol": "mi",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "1609.344",
"offset": "0"
},
{
"symbol": "s",
"dimension": [
0,
0,
1,
0,
0,
0,
0
],
"factor": "1",
"offset": "0"
},
{
"symbol": "h",
"dimension": [
0,
0,
1,
0,
0,
0,
0
],
"factor": "3600",
"offset": "0"
}
],
"quantity_kind": "absolute",
"start_value": "60",
"start_unit": [
{
"unit": "mi",
"power": 1
},
{
"unit": "h",
"power": -1
}
],
"steps": [
{
"to_unit": [
{
"unit": "m",
"power": 1
},
{
"unit": "h",
"power": -1
}
],
"claimed_value": "96560.64",
"round_places": null
},
{
"to_unit": [
{
"unit": "m",
"power": 1
},
{
"unit": "s",
"power": -1
}
],
"claimed_value": "26.82",
"round_places": 2
}
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/unit-conversion-trace-check/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"units":[{"symbol":"m","dimension":[1,0,0,0,0,0,0],"factor":"1","offset":"0"},{"symbol":"mi","dimension":[1,0,0,0,0,0,0],"factor":"1609.344","offset":"0"},{"symbol":"s","dimension":[0,0,1,0,0,0,0],"factor":"1","offset":"0"},{"symbol":"h","dimension":[0,0,1,0,0,0,0],"factor":"3600","offset":"0"}],"quantity_kind":"absolute","start_value":"60","start_unit":[{"unit":"mi","power":1},{"unit":"h","power":-1}],"steps":[{"to_unit":[{"unit":"m","power":1},{"unit":"h","power":-1}],"claimed_value":"96560.64","round_places":null},{"to_unit":[{"unit":"m","power":1},{"unit":"s","power":-1}],"claimed_value":"26.82","round_places":2}]}'
The machine-readable contract is at /v1/tools/unit-conversion-trace-check/versions/1.0.0.
CLI
node cli.mjs run unit-conversion-trace-check 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Rational trace check: Check a step-by-step rational calculation trace; reports the first step whose operand, operator or result disagrees.
- Chi square decomposition check: Check a claimed Pearson chi-square, its per-cell (O-E)^2/E terms and df exactly; returns the first wrong term.
- Contingency expected check: Check claimed expected counts (row total x column total / N) of a count table exactly; returns the first wrong cell.
- Contingency margins check: Check claimed row, column and grand totals of a count table exactly; returns the first wrong total.
- Resolution proof check: Check each binary resolution step (antecedents, pivot, resolvent) of a proof over a CNF; report the first bad step.
- Dimension equation check: Check both sides of an equation have the same dimension (optionally a claimed one); returns the first bad node or side.