Skip to content

Fix floating-point comparison bug in _get_tpr_index#109

Closed
du1204 wants to merge 1 commit into
facebookresearch:mainfrom
du1204:export-D94187721
Closed

Fix floating-point comparison bug in _get_tpr_index#109
du1204 wants to merge 1 commit into
facebookresearch:mainfrom
du1204:export-D94187721

Conversation

@du1204
Copy link
Copy Markdown
Contributor

@du1204 du1204 commented Feb 26, 2026

Summary:
Fix IndexError in _get_tpr_index caused by exact float equality (==) against np.linspace-generated thresholds (e.g., 0.060000000000000005 ≠ 0.06). Found via F1040508640.

Replaced with AnalysisNode.get_tpr_index() static method using np.isclose, which raises ValueError on true misalignment. All call sites updated to use the shared method directly.

Reviewed By: mgrange1998

Differential Revision: D94187721

Summary:
Fix `IndexError` in `_get_tpr_index` caused by exact float equality (`==`) against `np.linspace`-generated thresholds (e.g., `0.060000000000000005 ≠ 0.06`). Found via F1040508640.

Replaced with `AnalysisNode.get_tpr_index()` static method using `np.isclose`, which raises `ValueError` on true misalignment. All call sites updated to use the shared method directly.

Reviewed By: mgrange1998

Differential Revision: D94187721
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 26, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Feb 26, 2026

@du1204 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D94187721.

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Feb 26, 2026

This pull request has been merged in 4d15e39.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants