Commit b12b32c
committed
fix(sonar): drop float-equality boundary checks in _percentile (S1244)
Iteration 4: the previous max/min clamp introduced two S1244 BUGs
('Do not perform equality checks with floating point values') at
the if clamped_q == 0.0 and == 1.0 boundary returns. Removing those
guards entirely: the linear-interpolation path below already collapses
to sorted_values[lo] when lo == hi, which is exactly what happens at
clamped_q == 0 (pos = 0) and clamped_q == 1 (pos = n-1). Same
semantics, no float-equality compares, no flow-analysis flags.
Verified locally: q ∈ {-1, 0, 0.5, 1, 2}, empty list, single-element
list all return the expected values.1 parent 3af1762 commit b12b32c
1 file changed
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
91 | 92 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | 93 | | |
97 | 94 | | |
98 | 95 | | |
| |||
0 commit comments