)]}'
{
  "commit": "47c2531e253afc4ccf7933fd8f13c67624bcce02",
  "tree": "196a44e4212ccc9e24bbef46f73ca88d8aa90b04",
  "parents": [
    "dc72c9b1d01d7a53cb913001e468ac72f00bee92"
  ],
  "author": {
    "name": "Laramie Leavitt",
    "email": "lar@google.com",
    "time": "Mon Nov 16 09:29:59 2026 -0800"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Mon Nov 16 12:24:59 2026 -0800"
  },
  "message": "Fix two numerical defects in `absl::gaussian_distribution`\u0027s Ziggurat\nimplementation:\n\n1. Disjoint strip/variate bit extraction near x \u003d 0 (`gaussian_distribution.h`):\n   Previously, `zignor()` extracted strip index `i \u003d bits \u0026 0x7f` and passed\n   the same `bits` to `GenerateRealFromBits\u003cdouble, GenerateSignedTag, false\u003e`.\n   Whenever `|j| \u003c 2^-4` (`clz \u003e\u003d 5`, 6.25% of draws near the mode `x \u003d 0`),\n   the low mantissa bits overlapped `i`, locking small variates to wide strips\n   (`+31.8%` density error on `P(|Z| \u003c 2^-56)` and `-52.4%` on\n   `P(|Z| \u003c 2^-59)`), while `IncludeZero \u003d false` made `0.0` (and\n   `(-2.01e-19, +2.01e-19)`) unreachable even for\n   `gaussian_distribution\u003cfloat\u003e`.\n\n   `zignor()` now extracts completely disjoint bitfields from a single\n   `uint64_t`: `bits[0..6]` for strip `i` in `[0, 127]` and `bits[10..63]` as a\n   signed 54-bit integer `s \u003d static_cast\u003cint64_t\u003e(bits) \u003e\u003e 10` scaled by\n   `0x1p-53` to an exact double `j` in `[-1.0, 1.0)`. Compared to a\n   sign-magnitude encoding (`+/-mag * 2^-53`), the signed arithmetic-shift\n   encoding avoids double-weighting `0.0` (exact single-grid weight `2^-54`,\n   never produces `-0.0`), eliminates truncation-toward-zero bias on `E[|j|]`\n   and `E[j^2]`, and compiles to `sar` + `cvtsi2sd` + `mulsd`. At the sole\n   asymmetric endpoint `j \u003d -1.0` (`s \u003d -2^53`), every strip `i \u003e 0` enters\n   the wedge test at `f(x) \u003d f[i]` (rejected up to ~1 ULP libm `exp()`\n   rounding), and `i \u003d\u003d 0` routes to the negative tail fallback (net mean\n   shift `~ -1.6e-18`).\n\n2. Full 53-bit IEEE-754 Ziggurat constants and consistent `f[i]` table\n   (`gaussian_distribution.h`, `gaussian_distribution_gentables.cc`,\n   `gaussian_distribution.cc`):\n   Previously, `kR` and `kV` were truncated to 12-15 digits (5,287 and 42,826\n   ULPs off the exact 128-strip solution), accumulating a `+1.20e-9` area bias\n   on strip `i \u003d 127`, and `tables_.f[i]` stored recurrence `v` rather than\n   `std::exp(-0.5 * x[i] * x[i])` (up to 8 ULPs drift in wedge checks).\n\n   Updated `kR`, `kRInv`, and `kV` to full 53-bit IEEE-754 precision\n   (`kR \u003d 3.44261985589665212`, `kRInv \u003d 0.29047645161494128`,\n   `kV \u003d 9.91256303533646108e-3`), updated `TableGenerator` to advance the\n   recurrence via running `v` while storing `f(tables_.x[i])`, and regenerated\n   `gaussian_distribution.cc`. All 128 strip areas now match `kV` within\n   `2.68e-14` relative error (`1.61e-14` on strip 127) and `f[i]` matches\n   `std::exp(-0.5 * x[i] * x[i])` to 0 ULPs.\n\nNote: This change intentionally alters `absl::gaussian_distribution` output\nsequences (which are documented as not guaranteed to be stable) due to the\ndisjoint bit extraction and regenerated Ziggurat tables.\nPiperOrigin-RevId: 1022881797\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "42b59d3f3d31a6e6e633b6b9b65c7e54c4539653",
      "old_mode": 33188,
      "old_path": "absl/random/BUILD.bazel",
      "new_id": "fa71cea8771054e7f9dc6d32407a08d258a7784e",
      "new_mode": 33188,
      "new_path": "absl/random/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "b2c3fa2f87e0eae4e2735f1faea538d21d6b616a",
      "old_mode": 33188,
      "old_path": "absl/random/CMakeLists.txt",
      "new_id": "69053bed856a3d304184ec345d403c9963a09367",
      "new_mode": 33188,
      "new_path": "absl/random/CMakeLists.txt"
    },
    {
      "type": "modify",
      "old_id": "30ad3f0fe8aa7c4f3ade6629d938bc140fe4faef",
      "old_mode": 33188,
      "old_path": "absl/random/gaussian_distribution.cc",
      "new_id": "55c5a4ea31688665c289fde8b834554963043bb3",
      "new_mode": 33188,
      "new_path": "absl/random/gaussian_distribution.cc"
    },
    {
      "type": "modify",
      "old_id": "d14de0b2640a545fe3dc1dd494a1fdc9085db9b2",
      "old_mode": 33188,
      "old_path": "absl/random/gaussian_distribution.h",
      "new_id": "ccf314eae03420eb9dc551f42ed74bf75585942c",
      "new_mode": 33188,
      "new_path": "absl/random/gaussian_distribution.h"
    },
    {
      "type": "modify",
      "old_id": "65fd85a1bdd495a1577ef5ba9bee67475559a651",
      "old_mode": 33188,
      "old_path": "absl/random/gaussian_distribution_test.cc",
      "new_id": "eec40ade195a706e6dc9996092763f77f798c0fd",
      "new_mode": 33188,
      "new_path": "absl/random/gaussian_distribution_test.cc"
    },
    {
      "type": "modify",
      "old_id": "967a327b7f0b15b19348bbc1c499648607fba4db",
      "old_mode": 33188,
      "old_path": "absl/random/internal/gaussian_distribution_gentables.cc",
      "new_id": "ab444ab9daeac8e7d9ba6ad50db532601721db70",
      "new_mode": 33188,
      "new_path": "absl/random/internal/gaussian_distribution_gentables.cc"
    }
  ]
}
