[babl] tests: use a epsilon instead of == for float compare
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] tests: use a epsilon instead of == for float compare
- Date: Mon, 25 Sep 2017 18:33:42 +0000 (UTC)
commit 54cc1d1b1e1d65469cb51d97f340d29f579b7d92
Author: Øyvind Kolås <pippin gimp org>
Date: Mon Sep 25 20:33:17 2017 +0200
tests: use a epsilon instead of == for float compare
tests/grayscale_to_rgb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/tests/grayscale_to_rgb.c b/tests/grayscale_to_rgb.c
index 7da0c86..b239e23 100644
--- a/tests/grayscale_to_rgb.c
+++ b/tests/grayscale_to_rgb.c
@@ -59,7 +59,7 @@ test (void)
for (i = 0; i < PIXELS * 3; i++)
{
- if (rgb_buf[i] != rgb_buf_ref[i])
+ if (fabs (rgb_buf[i] - rgb_buf_ref[i]) > 0.0000001)
{
babl_log ("index %i is problematic : %f instead of %f",
i, rgb_buf[i], rgb_buf_ref[i]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]