Skip to content

Commit 4ed6c2a

Browse files
authored
Merge pull request #141 from adshieh/adshieh-isless
Quiet NaN comparisons
2 parents 0fd7ea8 + 2c976fc commit 4ed6c2a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/scs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,16 @@ static void print_footer(const ScsData *d, const ScsCone *k, ScsSolution *sol,
625625

626626
static scs_int has_converged(ScsWork *w, ScsResiduals *r, scs_int iter) {
627627
scs_float eps = w->stgs->eps;
628-
if (r->res_pri < eps && r->res_dual < eps && r->rel_gap < eps) {
628+
if (isless(r->res_pri, eps) && isless(r->res_dual, eps) &&
629+
isless(r->rel_gap, eps)) {
629630
return SCS_SOLVED;
630631
}
631632
/* Add iter > 0 to avoid strange edge case where infeasible point found
632633
* right at start of run `out/demo_SOCP_indirect 2 0.1 0.3 1506264403` */
633-
if (r->res_unbdd < eps && iter > 0) {
634+
if (isless(r->res_unbdd, eps) && iter > 0) {
634635
return SCS_UNBOUNDED;
635636
}
636-
if (r->res_infeas < eps && iter > 0) {
637+
if (isless(r->res_infeas, eps) && iter > 0) {
637638
return SCS_INFEASIBLE;
638639
}
639640
return 0;

0 commit comments

Comments
 (0)