summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/util.h')
-rw-r--r--lib/libalpm/util.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index c66e9881..eb1cad36 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -36,6 +36,8 @@
#include <time.h>
#include <sys/stat.h> /* struct stat */
#include <archive.h> /* struct archive */
+#include <math.h> /* fabs */
+#include <float.h> /* DBL_EPSILON */
#ifdef ENABLE_NLS
#include <libintl.h> /* here so it doesn't need to be included elsewhere */
@@ -63,7 +65,9 @@
#define RET_ERR(err, ret) do { pm_errno = (err); \
_alpm_log(PM_LOG_DEBUG, "returning error %d from %s : %s\n", err, __func__, alpm_strerrorlast()); \
- return(ret); } while(0)
+ return (ret); } while(0)
+
+#define DOUBLE_EQ(x, y) (fabs((x) - (y)) < DBL_EPSILON)
/**
* Used as a buffer/state holder for _alpm_archive_fgets().