Skip to content

Commit

Permalink
Update piecewise_linear_model.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
yangzq50 authored Nov 1, 2024
1 parent 77f441c commit 5d25a6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/pgm/piecewise_linear_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ size_t make_segmentation(size_t n, size_t start, size_t end, size_t epsilon, Fin
add_point(in(i), i);
}
}
if (end >= 2 && in(end - 1) != in(end - 2))
if (end >= start + 2 && in(end - 1) != in(end - 2))

Check notice

Code scanning / CodeQL

Equality test on floating-point values Note

Equality checks on floating point values can yield unexpected results.
add_point(in(end - 1), end - 1);

if (end == n) {
Expand Down

0 comments on commit 5d25a6b

Please sign in to comment.