summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormayeut <mayeut@users.noreply.github.com>2015-10-15 15:52:01 +0200
committermayeut <mayeut@users.noreply.github.com>2015-10-15 15:52:01 +0200
commit9542c08d62297509a5097a3800478013c2534379 (patch)
treefea5171edc71365d460221842599418ac09b5aa0
parentcbaa2d7d9834a761638e3a767dc93eb3a8e66549 (diff)
Don't rely on float equality
Fix #591
-rw-r--r--libopenjpeg/tcd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c
index 62904eb2..190d7f99 100644
--- a/libopenjpeg/tcd.c
+++ b/libopenjpeg/tcd.c
@@ -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;