diff options
Diffstat (limited to 'tools/lib/h5diff_array.c')
-rw-r--r-- | tools/lib/h5diff_array.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 71ada53..d592528 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -102,29 +102,29 @@ static hbool_t not_comparable; -#define PER(A,B) { \ - per = -1; \ - not_comparable = FALSE; \ - both_zero = FALSE; \ - if(0 == (A) && 0 == (B)) \ - both_zero = TRUE; \ - if(0 != (A)) \ - per = (double)ABS((double)((B) - (A)) / (double)(A)); \ - else \ - not_comparable = TRUE; \ +#define PER(A,B) { \ + per = -1; \ + not_comparable = FALSE; \ + both_zero = FALSE; \ + if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \ + both_zero = TRUE; \ + if(!H5_DBL_ABS_EQUAL(0,A)) \ + per = (double)ABS((double)((B) - (A)) / (double)(A)); \ + else \ + not_comparable = TRUE; \ } -#define PER_UNSIGN(TYPE,A,B) { \ - per = -1; \ - not_comparable = FALSE; \ - both_zero = FALSE; \ - if((A) == 0 && (B) == 0) \ - both_zero = TRUE; \ - if((A) != 0) \ - per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \ - else \ - not_comparable = TRUE; \ +#define PER_UNSIGN(TYPE,A,B) { \ + per = -1; \ + not_comparable = FALSE; \ + both_zero = FALSE; \ + if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \ + both_zero = TRUE; \ + if(!H5_DBL_ABS_EQUAL(0,A)) \ + per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \ + else \ + not_comparable = TRUE; \ } |