Skip to content

Commit

Permalink
Merge pull request #141 from adshieh/adshieh-isless
Browse files Browse the repository at this point in the history
Quiet NaN comparisons
  • Loading branch information
bodono authored Jun 5, 2020
2 parents 0fd7ea8 + 2c976fc commit 4ed6c2a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/scs.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,15 +625,16 @@ static void print_footer(const ScsData *d, const ScsCone *k, ScsSolution *sol,

static scs_int has_converged(ScsWork *w, ScsResiduals *r, scs_int iter) {
scs_float eps = w->stgs->eps;
if (r->res_pri < eps && r->res_dual < eps && r->rel_gap < eps) {
if (isless(r->res_pri, eps) && isless(r->res_dual, eps) &&
isless(r->rel_gap, eps)) {
return SCS_SOLVED;
}
/* Add iter > 0 to avoid strange edge case where infeasible point found
* right at start of run `out/demo_SOCP_indirect 2 0.1 0.3 1506264403` */
if (r->res_unbdd < eps && iter > 0) {
if (isless(r->res_unbdd, eps) && iter > 0) {
return SCS_UNBOUNDED;
}
if (r->res_infeas < eps && iter > 0) {
if (isless(r->res_infeas, eps) && iter > 0) {
return SCS_INFEASIBLE;
}
return 0;
Expand Down

0 comments on commit 4ed6c2a

Please sign in to comment.