Commit 31fc31a1 authored by Debarshi Ray's avatar Debarshi Ray

build, utils: Adjust how the floating point tolerance is defined

A subsequent commit will switch to using G_APPROX_VALUE instead of
photos_utils_equal_double. Since G_APPROX_VALUE requires specifying the
tolerance value, it would be convenient to have it defined somewhere
that's already accessible to every source file to avoid having to
#include a separate header to compare floating point values. Every
source file already #includes config.h, so that's the natural choice.
parent 35950d24
......@@ -64,6 +64,8 @@ AM_GNU_GETTEXT_VERSION([0.19.8])
AX_REQUIRE_DEFINED([AM_GNU_GETTEXT])
AM_GNU_GETTEXT([external])
AC_DEFINE([PHOTOS_EPSILON], [1e-5], [Tolerance when comparing single or double precision floating point values])
LT_INIT
AC_CHECK_LIB([jpeg], [jpeg_destroy_decompress], , AC_MSG_ERROR([JPEG library not found]))
......
......@@ -69,9 +69,6 @@
#include "photos-utils.h"
static const gdouble EPSILON = 1e-5;
GdkPixbuf *
photos_utils_center_pixbuf (GdkPixbuf *pixbuf, gint size)
{
......@@ -779,7 +776,7 @@ gboolean
photos_utils_equal_double (gdouble a, gdouble b)
{
const gdouble diff = a - b;
return diff > -EPSILON && diff < EPSILON;
return diff > -PHOTOS_EPSILON && diff < PHOTOS_EPSILON;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment