Don't rely on float equality

Fix #591
This commit is contained in:
mayeut 2015-10-15 15:52:01 +02:00
parent cbaa2d7d98
commit 9542c08d62
1 changed files with 1 additions and 1 deletions

View File

@ -988,7 +988,7 @@ void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final) {
n = passno + 1; n = passno + 1;
continue; 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; n = passno + 1;
} }
layer->numpasses = n - cblk->numpassesinlayers; layer->numpasses = n - cblk->numpassesinlayers;