Repository navigation
Compute float bin centres without overflowing near the float64 limits - #76
Merged
Merged
Conversation
Fixes #75 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
guijacquemet
marked this pull request as ready for review
November 7, 2026 00:19
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #75
PlaneHistogram.representativesformedlo + half_range * fraction, where the fraction reaches almost 2, so the product overflowed to inf for pixels near +-float64 max although the centre is representable. The arithmetic moves tofloat_bin_centres(new pure modulebin_centres.py): only bins whose plain result is non-finite are recomputed from the midpoint; all other bins keep the original arithmetic. (Moved out of histogram.py because its length baseline is shrink-only.)End-to-end test in tests/test_pooling.py: pixels at -/+limit -> compute_plane_histogram -> PooledHistogram -> linear_percentile/percentile at q = 0/25/50/75/100, against an exact
fractionsreference. The float64-max cases fail on main (5 failures) and pass here.Bitwise:
tools/dump_outputs.pySHA-256 identical on main (3d35529) and this branch:dfd5e740e04e16057bc6a017e844ae62cb94025690531b443a9489f52900537e.Gate:
python tools/check.py659 passed, 2 skipped (csbdeep not installed, tests/test_rgb.py:78), code rules clean.Generated by Claude Code