diff --git a/perform/benchpar.c b/perform/benchpar.c index 5253263f7e..12dd8e0c8a 100644 --- a/perform/benchpar.c +++ b/perform/benchpar.c @@ -1,6 +1,8 @@ #include #include #include +#include + #include "hdf5.h" /* Local macros */ @@ -14,8 +16,9 @@ #define ONE_KB 1024 #define ONE_MB (ONE_KB * ONE_KB) #define ONE_GB (ONE_MB * ONE_KB) + /* 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))) /* Control default behavior (with no command line arguments) */ #define DEFAULT_RANK 3 diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 0769676f26..00b270ccfb 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -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