diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2007-02-26 16:55:45 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2007-02-26 16:55:45 (GMT) |
commit | 3ea2c632d50870966320bc13d716959745d1e7dd (patch) | |
tree | 08df6b152075c21887e0dc5abb34b88ad4719ec7 /test/dsets.c | |
parent | cd8dfb4650f45adf6d9a7205263378098f72d1c2 (diff) | |
download | hdf5-3ea2c632d50870966320bc13d716959745d1e7dd.zip hdf5-3ea2c632d50870966320bc13d716959745d1e7dd.tar.gz hdf5-3ea2c632d50870966320bc13d716959745d1e7dd.tar.bz2 |
[svn-r13388] Added a relative comparison between floating-point values to avoid compiler's
warning of comparing values with "==" or "!=".
Diffstat (limited to 'test/dsets.c')
-rw-r--r-- | test/dsets.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/dsets.c b/test/dsets.c index 81fcf11..196fefe 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -5160,7 +5160,7 @@ test_set_local(hid_t fapl) h5_fixname(FILENAME[5], fapl, filename, sizeof filename); /* Initialize the integer & floating-point dataset */ - n=0.0; + n=1.0; for (i = 0; i < DSET_DIM1; i++) for (j = 0; j < DSET_DIM2; j++) { points[i][j] = (int)n++; @@ -5356,7 +5356,9 @@ test_set_local(hid_t fapl) /* Check that the values read are the modified version of what was written */ for (i=0; i<dims[0]; i++) { for (j=0; j<dims[1]; j++) { - if (points_dbl[i][j] != check_dbl[i][j]) { + /* If the difference between two values is greater than 0.001%, they're + * considered not equal. */ + if(!DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001)) { H5_FAILED(); printf(" Line %d: Read different values than written.\n",__LINE__); printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); |