diff options
author | Peter Cao <xcao@hdfgroup.org> | 2009-07-28 20:08:09 (GMT) |
---|---|---|
committer | Peter Cao <xcao@hdfgroup.org> | 2009-07-28 20:08:09 (GMT) |
commit | 3bbdfcd5f75e6c0a2d215dbf3e4ad4140b339cfe (patch) | |
tree | 52f143691a35a8e3678263f5581f1807323451ba /tools/lib/h5diff_array.c | |
parent | 0e50d368cdba00f2139737134b33d177e12a782b (diff) | |
download | hdf5-3bbdfcd5f75e6c0a2d215dbf3e4ad4140b339cfe.zip hdf5-3bbdfcd5f75e6c0a2d215dbf3e4ad4140b339cfe.tar.gz hdf5-3bbdfcd5f75e6c0a2d215dbf3e4ad4140b339cfe.tar.bz2 |
[svn-r17255] Fixed Bug 1563 - h5diff and Infinity
Added test cases.
Diffstat (limited to 'tools/lib/h5diff_array.c')
-rw-r--r-- | tools/lib/h5diff_array.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 2cda3ba..735ea70 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -20,7 +20,6 @@ #include "h5tools.h" - #include <sys/timeb.h> #include <time.h> @@ -364,9 +363,9 @@ hsize_t diff_array( void *_mem1, * H5T_COMPOUND * Recursively call this function for each member * H5T_ARRAY - * Recursively call this function for each element� + * Recursively call this function for each element * H5T_VLEN - * Recursively call this function for each element� + * Recursively call this function for each element * H5T_STRING * compare byte by byte in a cycle from 0 to type_size. this type_size is the * value obtained by the get_size function but it is the string lenght for @@ -3056,15 +3055,11 @@ hsize_t diff_float(unsigned char *mem1, */ else { - - - for ( i = 0; i < nelmts; i++) { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - if (equal_float(temp1_float,temp2_float,options)==FALSE) { if ( print_data(options) ) @@ -5548,6 +5543,9 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) if (is_zero) return(equal_double(expected,value,options)); + if (value == expected) + return TRUE; + if ( ABS( (value-expected) / expected) < H5DIFF_DBL_EPSILON) return TRUE; else @@ -5609,6 +5607,9 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio if (is_zero) return(equal_ldouble(expected,value,options)); + if (value == expected) + return TRUE; + if ( ABS( (value-expected) / expected) < H5DIFF_DBL_EPSILON) return TRUE; else @@ -5673,6 +5674,9 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options) if (is_zero) return(equal_float(expected,value,options)); + if (value == expected) + return TRUE; + if ( ABS( (value-expected) / expected) < H5DIFF_FLT_EPSILON) return TRUE; else |