summaryrefslogtreecommitdiffstats
path: root/perform/zip_perf.c
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-05-07 20:49:51 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-05-07 20:49:51 (GMT)
commit36a0b8e3dd1c325c201c4cd5a094df8a3588fa9a (patch)
tree3b96461c83ae8daac9e59727b2f44b442372e2f0 /perform/zip_perf.c
parent96061d1be75049dd490f554405a60942c06f79dd (diff)
downloadhdf5-36a0b8e3dd1c325c201c4cd5a094df8a3588fa9a.zip
hdf5-36a0b8e3dd1c325c201c4cd5a094df8a3588fa9a.tar.gz
hdf5-36a0b8e3dd1c325c201c4cd5a094df8a3588fa9a.tar.bz2
[svn-r6822] Purpose:
Code Improvements/Bug Fixes Description: Comparison of equality of a double/float variable to 0.0 is not guaranteed to work and is bad practice. Solution: Test that the absolute value of the variable is < a very small positive number. Platforms tested: Modi4 (Parallel & Fortran) Verbena (C++ & Fortran) Arabica (Fortran) Misc. update:
Diffstat (limited to 'perform/zip_perf.c')
-rw-r--r--perform/zip_perf.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/perform/zip_perf.c b/perform/zip_perf.c
index 0769676..00b270c 100644
--- a/perform/zip_perf.c
+++ b/perform/zip_perf.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <errno.h>
#include <fcntl.h>
+#include <math.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/types.h>
@@ -78,10 +79,7 @@
#define MICROSECOND 1000000.0
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) (((t)==0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
-
-/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) (((t)==0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
+#define MB_PER_SEC(bytes,t) ((fabs(t)<0.0000000001) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
#ifndef TRUE
#define TRUE 1