{"id":"unit-result-check","version":"1.0.0","description":"Check a claimed converted value exactly or under declared rounding; returns the exact value and the claim error","supported_operations":["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"],"unsupported_operations":["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)"],"semantics":["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\"."],"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},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["units","quantity_kind","value","from_unit","to_unit","claimed_value","rounding"],"properties":{"units":{"type":"array","minItems":1,"maxItems":200,"items":{"type":"object","additionalProperties":false,"required":["symbol","dimension","factor","offset"],"properties":{"symbol":{"type":"string","minLength":1,"maxLength":32},"dimension":{"type":"array","minItems":7,"maxItems":7,"items":{"type":"integer","minimum":-12,"maximum":12}},"factor":{"type":"string","minLength":1,"maxLength":60,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+|/[1-9][0-9]*)?$"},"offset":{"type":"string","minLength":1,"maxLength":60,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+|/[1-9][0-9]*)?$"}}}},"quantity_kind":{"type":"string","enum":["absolute","interval"]},"value":{"type":"string","minLength":1,"maxLength":60,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+|/[1-9][0-9]*)?$"},"from_unit":{"type":"array","maxItems":8,"items":{"type":"object","additionalProperties":false,"required":["unit","power"],"properties":{"unit":{"type":"string","minLength":1,"maxLength":32},"power":{"type":"integer","enum":[-6,-5,-4,-3,-2,-1,1,2,3,4,5,6]}}}},"to_unit":{"type":"array","maxItems":8,"items":{"type":"object","additionalProperties":false,"required":["unit","power"],"properties":{"unit":{"type":"string","minLength":1,"maxLength":32},"power":{"type":"integer","enum":[-6,-5,-4,-3,-2,-1,1,2,3,4,5,6]}}}},"claimed_value":{"type":"string","minLength":1,"maxLength":60,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+|/[1-9][0-9]*)?$"},"rounding":{"type":"object","additionalProperties":false,"required":["method","digits"],"properties":{"method":{"type":"string","enum":["exact","decimal_places","significant_digits"]},"digits":{"type":["integer","null"],"minimum":0,"maximum":30}}}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","first_discrepancy","exact_value","expected_value","difference","reference_version"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"unknown_unit","invalid_affine_composition","dimension_mismatch","value_mismatch"]},"first_discrepancy":{"type":["object","null"],"additionalProperties":false,"required":["field","index","term_index","unit","expected","actual"],"properties":{"field":{"type":"string","enum":["from_unit","to_unit","claimed_value"]},"index":{"type":["integer","null"],"minimum":0},"term_index":{"type":["integer","null"],"minimum":0},"unit":{"type":["string","null"]},"expected":{"type":["string","null"]},"actual":{"type":["string","null"]}}},"exact_value":{"type":["string","null"]},"expected_value":{"type":["string","null"]},"difference":{"type":["string","null"]},"reference_version":{"type":"string","const":"jcgm-200-2012-vim3-si-brochure-9e-2019"}}},"examples":[{"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}},"output":{"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"}},{"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":"2.5","from_unit":[{"unit":"km","power":1}],"to_unit":[{"unit":"m","power":1}],"claimed_value":"250","rounding":{"method":"exact","digits":null}},"output":{"valid":false,"reason":"value_mismatch","first_discrepancy":{"field":"claimed_value","index":null,"term_index":null,"unit":null,"expected":"2500","actual":"250"},"exact_value":"2500","expected_value":"2500","difference":"-2250","reference_version":"jcgm-200-2012-vim3-si-brochure-9e-2019"}}],"execute_url":"/v1/tools/unit-result-check/versions/1.0.0/execute"}