Unit result check
unit-result-check · version 1.0.0 · Numbers & math · free, no key needed
Check a claimed converted value exactly or under declared rounding; returns the exact value and the claim error
Use when you need to: check converted value · verify unit conversion result · is this converted number right.
Decide before calling
Read the versioned contract and the supported scope below. Reuse unit-result-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-result-check@1.0.0 for check converted value. 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 converted value
- verify unit conversion result
- is this converted number right
- check rounding of converted value
- verify significant digits after conversion
- exact unit conversion result checker
Not supported
- a built-in unit catalog (every unit is defined by the caller)
- tolerance bands or measurement uncertainty
- scientific notation in numbers (write plain decimals or fractions)
- checking intermediate steps (use unit-conversion-trace-check)
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: unknown units in from_unit then to_unit, affine rule (absolute quantities only: an affine unit must be the sole term with power 1) in from_unit then to_unit, dimensions, then value_mismatch (expected = rounded value, actual = claim).
- exact_value = (value x F(from) + O(from) - O(to)) / F(to) (offsets ignored for quantity_kind interval). rounding.method exact (digits null) compares with it; decimal_places (digits 0..30) and significant_digits (digits 1..30, may round to tens or thousands) round half to even on the magnitude; zero stays 0.
- expected_value is the rounded value and difference = claimed_value - exact_value, all in canonical exact form (plain decimal when terminating, else reduced p/q); the three are null when the units are incompatible.
- Structural problems throw invalid_input; more than 200 units, 8 terms, |power| 6, 30 rounding digits, 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)value(string, required): min length 1; max length 60; pattern^-?(0|[1-9][0-9]*)(\.[0-9]+|/[1-9][0-9]*)?$from_unit(array of object, required): max items 8to_unit(array of object, required): max items 8claimed_value(string, required): min length 1; max length 60; pattern^-?(0|[1-9][0-9]*)(\.[0-9]+|/[1-9][0-9]*)?$rounding(object, required)
Output
valid(boolean, required)reason(one of null, "unknown_unit", "invalid_affine_composition", "dimension_mismatch", "value_mismatch", required)first_discrepancy(object or null, required)exact_value(string or null, required)expected_value(string or null, required)difference(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 round digits: 30
Example
Request input:
{
"units": [
{
"symbol": "m",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "1",
"offset": "0"
},
{
"symbol": "km",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "1000",
"offset": "0"
},
{
"symbol": "au",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "149597870700",
"offset": "0"
}
],
"quantity_kind": "absolute",
"value": "1",
"from_unit": [
{
"unit": "au",
"power": 1
}
],
"to_unit": [
{
"unit": "km",
"power": 1
}
],
"claimed_value": "149600000",
"rounding": {
"method": "significant_digits",
"digits": 4
}
}
Response:
{
"result": {
"valid": true,
"reason": null,
"first_discrepancy": null,
"exact_value": "149597870.7",
"expected_value": "149600000",
"difference": "2129.3",
"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-result-check",
"version": "1.0.0",
"input": {
"units": [
{
"symbol": "m",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "1",
"offset": "0"
},
{
"symbol": "km",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "1000",
"offset": "0"
},
{
"symbol": "au",
"dimension": [
1,
0,
0,
0,
0,
0,
0
],
"factor": "149597870700",
"offset": "0"
}
],
"quantity_kind": "absolute",
"value": "1",
"from_unit": [
{
"unit": "au",
"power": 1
}
],
"to_unit": [
{
"unit": "km",
"power": 1
}
],
"claimed_value": "149600000",
"rounding": {
"method": "significant_digits",
"digits": 4
}
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/unit-result-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":"km","dimension":[1,0,0,0,0,0,0],"factor":"1000","offset":"0"},{"symbol":"au","dimension":[1,0,0,0,0,0,0],"factor":"149597870700","offset":"0"}],"quantity_kind":"absolute","value":"1","from_unit":[{"unit":"au","power":1}],"to_unit":[{"unit":"km","power":1}],"claimed_value":"149600000","rounding":{"method":"significant_digits","digits":4}}'
The machine-readable contract is at /v1/tools/unit-result-check/versions/1.0.0.
CLI
node cli.mjs run unit-result-check 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Rational expression check: Check a claimed exact rational value of an integer/fraction expression; reports the true value and the difference.
- Unit factor check: Check a claimed conversion factor and offset between two unit expressions using caller-defined exact unit definitions
- 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.
- Chromatic certificate check: Check a claim chi(G) = k: a proper k-colouring plus a clique or bounded exhaustive proof; returns the first discrepancy.
- Linear residual check: Check a claimed residual r = b - A x (per component and/or its max norm) exactly for an approximate solution x.
- Lp primal feasibility check: Check that a claimed LP point satisfies x >= 0 and Ax <= b exactly; report the first violated bound or row.