Skip to content

Commit

Permalink
Use reverse condition '>'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed Sep 9, 2022
1 parent 52a5b41 commit 4145b4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pyhf/infer/calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,11 @@ def _false_case():
teststat = (qmu - qmu_A) / (2 * self.sqrtqmuA_v)
return teststat

# Use '<=' rather than '<' to avoid Issue #1992
# Use '>' rather than reverse condition with '<=' to avoid
# equating floating point numbers.
# This comparison is done to avoid Issue #1992.
teststat = tensorlib.conditional(
(sqrtqmu_v <= self.sqrtqmuA_v), _true_case, _false_case
(self.sqrtqmuA_v > sqrtqmu_v), _true_case, _false_case
)
return tensorlib.astensor(teststat)

Expand Down

0 comments on commit 4145b4d

Please sign in to comment.