)]}'
{
  "commit": "c2a809a3255da86743a677ffcad11806492ff8ef",
  "tree": "271e35cb732c28ab1df5753a15022447dd66c141",
  "parents": [
    "41a6e8c212c6d6cd2ae5abf77e8d3680c2801cfb"
  ],
  "author": {
    "name": "Laramie Leavitt",
    "email": "lar@google.com",
    "time": "Sun Nov 15 23:00:19 2026 -0800"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Mon Nov 16 14:38:30 2026 -0800"
  },
  "message": "Fix `discrete_distribution` normalization, aliasing, and range overflow.\n\n* Add a defensive `{1.0}` fallback for all-zero weight vectors (violating\n  `[rand.dist.samp.discrete]`\u0027s `S \u003e 0` precondition) instead of dividing\n  `0.0 / 0.0` (`NaN`), and pre-scale by the maximum weight when finite weights\n  overflow `double` summation (normalizing whenever the rescaled sum differs\n  from `1.0`).\n* Accumulate weights with Neumaier compensated summation (in both the initial\n  and overflow-rescaled passes) and tighten the normalization skip tolerance to\n  a constant `16 * eps` on the non-overflowing path so `O(eps)` summation error\n  preserves bit-exact stream round-trips even for large non-power-of-two `n`\n  without allowing `n * (1 - sum)` to grow quadratically with `n`.\n* Preserve `q[i].first` for any residual `under` entries after the alias loop\n  and alias only the remaining `1.0 - q[i].first` mass to `nonzero_idx`\n  (`q[i].second \u003d nonzero_idx`), preventing zero or tiny nonzero weights from\n  being inflated to `1.0`.\n* In the unary-operation constructor, guard against `xmax - xmin` overflowing\n  to `+inf` on wide finite ranges (such as `[-1.7e308, 1.7e308]`) by falling\n  back to an overflow-free convex midpoint combination\n  (`w_lo * xmin + w_hi * xmax`) while keeping the existing formula bit-identical\n  on finite spans.\n\nPiperOrigin-RevId: 1022529302\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "247faa84fb1cb1a149d1f09e94c0e54a07fdac53",
      "old_mode": 33188,
      "old_path": "absl/random/discrete_distribution.cc",
      "new_id": "cb693847cd91e4a860690eb334729ad9abc6e878",
      "new_mode": 33188,
      "new_path": "absl/random/discrete_distribution.cc"
    },
    {
      "type": "modify",
      "old_id": "35d42c80b6af37b3746cb56e73597836f704abb2",
      "old_mode": 33188,
      "old_path": "absl/random/discrete_distribution.h",
      "new_id": "19729d2402f533aa042b951982e1d5a25472dbfc",
      "new_mode": 33188,
      "new_path": "absl/random/discrete_distribution.h"
    },
    {
      "type": "modify",
      "old_id": "9d961f779da72a72b4bb8d7feaa2d9b9a43f9686",
      "old_mode": 33188,
      "old_path": "absl/random/discrete_distribution_test.cc",
      "new_id": "8005e4b888e02ef2afb4e8a0fc5d90f03be5cd6a",
      "new_mode": 33188,
      "new_path": "absl/random/discrete_distribution_test.cc"
    }
  ]
}
