313373cc10
_bin_expr clipped the bin index to [0, nbins-1] only after casting it to Int32, so the clip never got the chance to do its job: a rollout step_length of 1.0725e10 mm against fixed edges [2.9e-5, 94.04] with 50 bins gives a raw index of ~5.7e9, which overflows i32 and fails the strict cast, killing the whole compute-one job. Same for +/-inf. Clamp in f64 first and cast after. NaN has no edge to clamp to, so map it to null and drop it in the two callers (hist1d, profile_partial) — what np.histogram does with it, and what profile_partial needs anyway since a null bin index would break its np.add.at. Partials computed before this change stay valid: the old code crashed on these values rather than binning them wrong, so any chunk that produced a partial contained none of them and its counts are unchanged here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>