Skip to content

Commit

Permalink
Don't rely on float equality
Browse files Browse the repository at this point in the history
Fix #591
  • Loading branch information
mayeut committed Oct 15, 2015
1 parent cbaa2d7 commit 9542c08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libopenjpeg/tcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final) {
n = passno + 1;
continue;
}
if (dd / dr >= thresh)
if (thresh - (dd / dr) < DBL_EPSILON) /* do not rely on float equality, check with DBL_EPSILON margin */
n = passno + 1;
}
layer->numpasses = n - cblk->numpassesinlayers;
Expand Down

0 comments on commit 9542c08

Please sign in to comment.