Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle some floating point edge cases in truncation #65

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

caleb-johnson
Copy link
Collaborator

No description provided.

@@ -168,7 +168,9 @@ def truncate_binary_search(
lower_error = 0.0

# binary search for a cutoff threshold
while ((upper_threshold - lower_threshold) > 1e-10) and (upper_error != lower_error):
while ((upper_threshold - lower_threshold) > 1e-10) and not (
np.isclose(upper_error, lower_error)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default atol is 1e-8, @BryceFuller , @mrossinek . Is that fine? We don't take a tolerance to this func as input

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit arbitrary to me, to mix the 1e-10 threshold in the first statement with an atol=1e-8 and rtol=1e-5 in np.isclose. If we could unify that and maybe even expose it as a setting that would be better imo

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BryceFuller and I are also trying to determine if we need both while conditionals here. Need to think on it a bit before finishing this up

@coveralls
Copy link

coveralls commented Mar 5, 2025

Pull Request Test Coverage Report for Build 13680724529

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 13624505967: 0.0%
Covered Lines: 431
Relevant Lines: 431

💛 - Coveralls

@caleb-johnson caleb-johnson requested a review from mrossinek March 5, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants