From 9542c08d62297509a5097a3800478013c2534379 Mon Sep 17 00:00:00 2001 From: mayeut Date: Thu, 15 Oct 2015 15:52:01 +0200 Subject: [PATCH] Don't rely on float equality Fix #591 --- libopenjpeg/tcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;