{
  "contract": "calculatorx-uuce-public-conformance-v1",
  "calculation_version": "0.1.0",
  "references": {
    "nist-foot": {
      "url": "https://www.nist.gov/pml/us-surveyfoot/revised-unit-conversion-factors",
      "basis": "International foot = 0.3048 m, U.S. survey foot = 1200/3937 m. Invert each ratio."
    },
    "nist-temperature": {
      "url": "https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b8",
      "basis": "Apply the exact point formulas. Subtract two point formulas to obtain the interval factor."
    },
    "bipm-angle": {
      "url": "https://www.bipm.org/en/publications/si-brochure",
      "basis": "The plane-angle relation gives 180 degrees = pi radians."
    },
    "decimal-policy": {
      "url": "https://www.calculatorx.com/developers/units#execution",
      "basis": "A decimal midpoint rounds to the even retained digit. Binary64 may overflow or underflow while an exact value remains available."
    },
    "execution-contract": {
      "url": "https://www.calculatorx.com/developers/units#execution",
      "basis": "Both units must support the stated quantity kind and role."
    }
  },
  "cases": [
    {
      "id": "international-foot",
      "inputs": {
        "value": "1",
        "from_unit_id": "cx:m",
        "to_unit_id": "cx:ft_i",
        "quantity_kind": "length",
        "role": "scalar",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "exact": {
          "numerator": "1250",
          "denominator": "381",
          "pi_power": 0
        }
      },
      "reference": "nist-foot"
    },
    {
      "id": "survey-foot",
      "inputs": {
        "value": "1",
        "from_unit_id": "cx:m",
        "to_unit_id": "cx:ft_us",
        "quantity_kind": "length",
        "role": "scalar",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "exact": {
          "numerator": "3937",
          "denominator": "1200",
          "pi_power": 0
        }
      },
      "reference": "nist-foot"
    },
    {
      "id": "freezing-point",
      "inputs": {
        "value": "32",
        "from_unit_id": "cx:degF",
        "to_unit_id": "cx:degC",
        "quantity_kind": "temperature",
        "role": "point",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "exact": {
          "numerator": "0",
          "denominator": "1",
          "pi_power": 0
        },
        "decimal": "0"
      },
      "reference": "nist-temperature"
    },
    {
      "id": "temperature-interval",
      "inputs": {
        "value": "10",
        "from_unit_id": "cx:degC",
        "to_unit_id": "cx:degF",
        "quantity_kind": "temperature",
        "role": "interval",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "exact": {
          "numerator": "18",
          "denominator": "1",
          "pi_power": 0
        },
        "decimal": "1.8e1"
      },
      "reference": "nist-temperature"
    },
    {
      "id": "absolute-zero",
      "inputs": {
        "value": "-273.15",
        "from_unit_id": "cx:degC",
        "to_unit_id": "cx:K",
        "quantity_kind": "temperature",
        "role": "point",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "exact": {
          "numerator": "0",
          "denominator": "1",
          "pi_power": 0
        },
        "decimal": "0"
      },
      "reference": "nist-temperature"
    },
    {
      "id": "below-absolute-zero",
      "inputs": {
        "value": "-273.15000000000000001",
        "from_unit_id": "cx:degC",
        "to_unit_id": "cx:K",
        "quantity_kind": "temperature",
        "role": "point",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "code": "VALUE_OUT_OF_RANGE",
        "http_status": 400
      },
      "reference": "nist-temperature"
    },
    {
      "id": "straight-angle",
      "inputs": {
        "value": "180",
        "from_unit_id": "cx:deg",
        "to_unit_id": "cx:rad",
        "quantity_kind": "plane_angle",
        "role": "scalar",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "exact": {
          "numerator": "1",
          "denominator": "1",
          "pi_power": 1
        },
        "decimal": "3.141592653589793238462643383279503e0"
      },
      "reference": "bipm-angle"
    },
    {
      "id": "decimal-midpoint",
      "inputs": {
        "value": "1.0000000000000000000000000000000005",
        "from_unit_id": "cx:m",
        "to_unit_id": "cx:m",
        "quantity_kind": "length",
        "role": "scalar",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "exact": {
          "numerator": "2000000000000000000000000000000001",
          "denominator": "2000000000000000000000000000000000",
          "pi_power": 0
        },
        "decimal": "1e0"
      },
      "reference": "decimal-policy"
    },
    {
      "id": "binary64-overflow",
      "inputs": {
        "value": "1e308",
        "from_unit_id": "cx:m",
        "to_unit_id": "cx:mm",
        "quantity_kind": "length",
        "role": "scalar",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "decimal": "1e311",
        "binary64": null,
        "binary64_status": "overflow"
      },
      "reference": "decimal-policy"
    },
    {
      "id": "binary64-underflow",
      "inputs": {
        "value": "0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e-308",
        "from_unit_id": "cx:m",
        "to_unit_id": "cx:m",
        "quantity_kind": "length",
        "role": "scalar",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "decimal": "1e-409",
        "binary64": null,
        "binary64_status": "underflow"
      },
      "reference": "decimal-policy"
    },
    {
      "id": "ambiguous-foot",
      "inputs": {
        "value": "1",
        "from_unit_id": "cx:m",
        "to_unit_id": "ft",
        "quantity_kind": "length",
        "role": "scalar",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "code": "AMBIGUOUS_UNIT",
        "http_status": 400,
        "candidates": [
          "cx:ft_i",
          "cx:ft_us"
        ]
      },
      "reference": "nist-foot"
    },
    {
      "id": "role-mismatch",
      "inputs": {
        "value": "1",
        "from_unit_id": "cx:m",
        "to_unit_id": "cx:ft_i",
        "quantity_kind": "length",
        "role": "point",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "code": "UNIT_ROLE_MISMATCH",
        "http_status": 400
      },
      "reference": "execution-contract"
    },
    {
      "id": "quantity-kind-mismatch",
      "inputs": {
        "value": "1",
        "from_unit_id": "cx:m",
        "to_unit_id": "cx:K",
        "quantity_kind": "length",
        "role": "scalar",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "code": "QUANTITY_KIND_MISMATCH",
        "http_status": 400
      },
      "reference": "execution-contract"
    },
    {
      "id": "snapshot-mismatch",
      "inputs": {
        "value": "1",
        "from_unit_id": "cx:m",
        "to_unit_id": "cx:ft_i",
        "quantity_kind": "length",
        "role": "scalar",
        "snapshot": "0.2.0-preview.1"
      },
      "expected": {
        "code": "SNAPSHOT_MISMATCH",
        "http_status": 409,
        "supported_snapshot": "0.3.0-preview.3"
      },
      "reference": "execution-contract"
    },
    {
      "id": "engine-version-mismatch",
      "calculation_version": "9.0.0",
      "inputs": {
        "value": "1",
        "from_unit_id": "cx:m",
        "to_unit_id": "cx:ft_i",
        "quantity_kind": "length",
        "role": "scalar",
        "snapshot": "0.3.0-preview.3"
      },
      "expected": {
        "code": "VERSION_MISMATCH",
        "http_status": 409,
        "published_version": "0.1.0"
      },
      "reference": "execution-contract"
    }
  ]
}
