mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
[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:
This commit is contained in:
parent
96061d1be7
commit
36a0b8e3dd
@ -1,6 +1,8 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
#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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user