{
 "spec": "floatexact/conformance/v1",
 "source": "coherence_lang/coherence_lang/fabric/floatexact.py",
 "note": "Doubles are IEEE-754 hex bit patterns, big-endian, so nothing is lost to decimal parsing. exact_bits is the infinite-precision dot product rounded once.",
 "cases": [
  {
   "name": "catastrophic cancellation",
   "why": "A large pair cancels exactly, so the answer is entirely the small terms. Naive summation destroys them before the cancellation happens.",
   "a_bits": [
    "4341c37937e08000",
    "3ff0000000000000",
    "c341c37937e08000",
    "3fe0000000000000"
   ],
   "b_bits": [
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000"
   ],
   "exact_bits": "3ff8000000000000",
   "exact_value": "1.5",
   "naive_distinct": 5,
   "naive_bits": [
    "0000000000000000",
    "3fe0000000000000",
    "3ff0000000000000",
    "3ff8000000000000",
    "4000000000000000"
   ]
  },
  {
   "name": "swamped by magnitude",
   "why": "One term is 2^53 times the others, so every small term falls off the end of the mantissa unless the accumulation is exact.",
   "a_bits": [
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "4340000000000000",
    "c340000000000000"
   ],
   "b_bits": [
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000"
   ],
   "exact_bits": "4028000000000000",
   "exact_value": "12.0",
   "naive_distinct": 10,
   "naive_bits": [
    "0000000000000000",
    "4010000000000000",
    "4014000000000000",
    "4018000000000000",
    "401c000000000000",
    "4020000000000000",
    "4022000000000000",
    "4024000000000000",
    "4026000000000000",
    "4028000000000000"
   ]
  },
  {
   "name": "a tie that moves",
   "why": "The exact sum lands precisely halfway between two doubles. Round-to-nearest-even gives one answer; getting there in a different order gives another.",
   "a_bits": [
    "3ff0000000000000",
    "3ca0000000000000",
    "3ca0000000000000"
   ],
   "b_bits": [
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000"
   ],
   "exact_bits": "3ff0000000000001",
   "exact_value": "1.0000000000000002",
   "naive_distinct": 2,
   "naive_bits": [
    "3ff0000000000000",
    "3ff0000000000001"
   ]
  },
  {
   "name": "alternating magnitudes",
   "why": "Signs alternate across eight orders of magnitude. Every reordering rounds somewhere else.",
   "a_bits": [
    "4197d78400000000",
    "c197d78400000000",
    "3e45798ee2308c3a",
    "3ff0000000000000",
    "bff0000000000000",
    "4197d78400000000",
    "c197d78400000000",
    "3e2e1094d643f784"
   ],
   "b_bits": [
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000"
   ],
   "exact_bits": "3e4cfdb417c18a1b",
   "exact_value": "1.35e-08",
   "naive_distinct": 11,
   "naive_bits": [
    "0000000000000000",
    "3e2e1094d0000000",
    "3e2e1094d643f784",
    "3e2e1094e0000000",
    "3e45798ee2308c3a",
    "3e4cfdb416308c3a",
    "3e4cfdb417c18a1b",
    "3e4cfdb418000000",
    "3e50000000000000",
    "3e53c2129a000000",
    "3e53c2129ac87ef0"
   ]
  },
  {
   "name": "into the subnormals",
   "why": "Terms decay below the smallest normal double, where the exponent is pinned and precision degrades bit by bit.",
   "a_bits": [
    "0000000000000001",
    "0000000000000001",
    "00000000000007e8",
    "80000000000007e8",
    "0000000000000005"
   ],
   "b_bits": [
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000",
    "3ff0000000000000"
   ],
   "exact_bits": "0000000000000007",
   "exact_value": "3.5e-323",
   "naive_distinct": 1,
   "naive_bits": [
    "0000000000000007"
   ]
  },
  {
   "name": "an ordinary dot product",
   "why": "Nothing adversarial: twenty-four random terms of the kind any real computation produces.",
   "a_bits": [
    "426c8600567f6742",
    "c254ad7a669939ca",
    "c265e29ccba6442a",
    "c245881c840b0fc8",
    "426b782c0e6888f8",
    "424f8d16c9a14908",
    "c268f96de6de0462",
    "423cc803fabfcc30",
    "4261c4f9efc05724",
    "c25d1d8c216cc171",
    "c26a2177322c4e86",
    "c267efcf0dfcf4ff",
    "c261b4c2a063a6e8",
    "c26a194b70a4f819",
    "c25aa75d50639724",
    "4244a96fbded4ce0",
    "42632b9a24dede5e",
    "c25ed87c3718c9d4",
    "424701e7ec6e9fc0",
    "c26b9f0cfa47d444",
    "426222ce1475a9f4",
    "c2505d75b653782c",
    "425d5791ba660fd0",
    "c254ed64f6ef8f18"
   ],
   "b_bits": [
    "41272367b69eb8b2",
    "411c7ff60047de39",
    "4120164e82dc6366",
    "412a93a5026650ff",
    "40fd6be589a71938",
    "4126190b4fb38372",
    "41046593df86c427",
    "4102715e22ba9a19",
    "412e2e836f828f5c",
    "410c1cd7237d5c75",
    "412af3cc991c112f",
    "411649e258a21804",
    "41238fdec28721d9",
    "41233b7b927641ce",
    "412deec5b416168d",
    "412945a043c92bc6",
    "412e65cf1d0a759c",
    "412478f57376d85e",
    "41290348d83e5c7b",
    "410c18c5383a7bf7",
    "411a2b3e92d93c8b",
    "410007f672aa69cc",
    "411819febb5f20ad",
    "4124126cffb31a2a"
   ],
   "exact_bits": "c3b0ee0ab4fb36f2",
   "exact_value": "-1.2199243214890563e+18",
   "naive_distinct": 7,
   "naive_bits": [
    "c3b0ee0ab4fb36f0",
    "c3b0ee0ab4fb36f1",
    "c3b0ee0ab4fb36f2",
    "c3b0ee0ab4fb36f3",
    "c3b0ee0ab4fb36f4",
    "c3b0ee0ab4fb36f5",
    "c3b0ee0ab4fb36f6"
   ]
  }
 ]
}