diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2007-03-12 15:52:52 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2007-03-12 15:52:52 (GMT) |
commit | 3015df0a5b02dee38264b191997c1949596c2c95 (patch) | |
tree | 6e26bbe1228af8a0ed8eea213f99989956350981 /test | |
parent | 8d91f0643b411da90476e2ac4fabca32b3045845 (diff) | |
download | hdf5-3015df0a5b02dee38264b191997c1949596c2c95.zip hdf5-3015df0a5b02dee38264b191997c1949596c2c95.tar.gz hdf5-3015df0a5b02dee38264b191997c1949596c2c95.tar.bz2 |
[svn-r13501] Suppress the compiler warning about the equality comparison of floating-point values.
Diffstat (limited to 'test')
-rw-r--r-- | test/h5test.h | 2 | ||||
-rw-r--r-- | test/tarray.c | 18 | ||||
-rw-r--r-- | test/tattr.c | 17 | ||||
-rw-r--r-- | test/tgenprop.c | 32 | ||||
-rw-r--r-- | test/th5s.c | 5 | ||||
-rw-r--r-- | test/tmisc.c | 16 | ||||
-rw-r--r-- | test/tvltypes.c | 14 |
7 files changed, 64 insertions, 40 deletions
diff --git a/test/h5test.h b/test/h5test.h index 41d476c..8c10faf 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -128,7 +128,7 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ * It's the test's responsibility not to pass in the value 0, which * may cause the equation to fail. */ -#define FLT_ABS_EQUAL(X,Y) (fabsf(X-Y)<FLT_EPSILON) +#define FLT_ABS_EQUAL(X,Y) ((float)fabs(X-Y)<FLT_EPSILON) #define DBL_ABS_EQUAL(X,Y) (fabs(X-Y)<DBL_EPSILON) #define LDBL_ABS_EQUAL(X,Y) (fabsl(X-Y)<LDBL_EPSILON) diff --git a/test/tarray.c b/test/tarray.c index 2664f7e..8c7e6c8 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -703,7 +703,7 @@ test_array_compound_atomic(void) TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",(int)i,(int)j,(int)wdata[i][j].i,(int)i,(int)j,(int)rdata[i][j].i); continue; } /* end if */ - if(wdata[i][j].f!=rdata[i][j].f) { + if(!FLT_ABS_EQUAL(wdata[i][j].f, rdata[i][j].f)) { TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n",(int)i,(int)j,wdata[i][j].f,(int)i,(int)j,rdata[i][j].f); continue; } /* end if */ @@ -948,7 +948,7 @@ test_array_compound_array(void) continue; } /* end if */ for(k=0; k<ARRAY1_DIM1; k++) - if(wdata[i][j].f[k]!=rdata[i][j].f[k]) { + if(!FLT_ABS_EQUAL(wdata[i][j].f[k],rdata[i][j].f[k])) { TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f[%d]=%f, rdata[%d][%d].f[%d]=%f\n",(int)i,(int)j,(int)k,wdata[i][j].f[k],(int)i,(int)j,(int)k,rdata[i][j].f[k]); continue; } /* end if */ @@ -1638,11 +1638,11 @@ test_array_bkg(void) TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; } - if(cf[i].b[j]!=cfr[i].b[j]) { + if(!FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) { TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]); continue; } - if(cf[i].c[j]!=cfr[i].c[j]) { + if(!DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) { TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]); continue; } @@ -1705,7 +1705,7 @@ test_array_bkg(void) for (i=0; i< LENGTH; i++) for (j = 0; j < ALEN; j++) - if(fld[i].b[j]!=fldr[i].b[j]) { + if(!FLT_ABS_EQUAL(fld[i].b[j],fldr[i].b[j])) { TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(float)fld[i].b[j],(int)i,(int)j,(float)fldr[i].b[j]); continue; } @@ -1731,11 +1731,11 @@ test_array_bkg(void) TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; } - if(cf[i].b[j]!=cfr[i].b[j]) { + if(!FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) { TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]); continue; } - if(cf[i].c[j]!=cfr[i].c[j]) { + if(!DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) { TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]); continue; } @@ -1780,11 +1780,11 @@ test_array_bkg(void) TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; } - if(cf[i].b[j]!=cfr[i].b[j]) { + if(!FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) { TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]); continue; } - if(cf[i].c[j]!=cfr[i].c[j]) { + if(!DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) { TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]); continue; } diff --git a/test/tattr.c b/test/tattr.c index d9ce186..c5d5e7a 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -96,7 +96,7 @@ int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data f #define ATTR3_DIM1 2 #define ATTR3_DIM2 2 #define ATTR3_DIM3 2 -double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3,-26.1},{0.123,-10.0}},{{981724.2,-0.91827},{2.0,23.0}}}; /* Test data for 3rd attribute */ +double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3,-26.1},{0.123,-10.0}},{{973.23,-0.91827},{2.0,23.0}}}; /* Test data for 3rd attribute */ #define ATTR4_NAME "Attr4" #define ATTR4_RANK 2 @@ -495,7 +495,7 @@ test_attr_flush(hid_t fapl) ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(rdata!=0.0) + if(!DBL_ABS_EQUAL(rdata,0.0)) TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0); ret=H5Fflush(fil, H5F_SCOPE_GLOBAL); @@ -504,7 +504,7 @@ test_attr_flush(hid_t fapl) ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(rdata!=0.0) + if(!DBL_ABS_EQUAL(rdata,0.0)) TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0); ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata); @@ -513,7 +513,7 @@ test_attr_flush(hid_t fapl) ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(rdata!=wdata) + if(!DBL_ABS_EQUAL(rdata,wdata)) TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,wdata); ret=H5Sclose(spc); @@ -980,8 +980,11 @@ test_attr_scalar_read(hid_t fapl) /* Read attribute information */ ret=H5Aread(attr,H5T_NATIVE_FLOAT,&rdata); CHECK(ret, FAIL, "H5Aread"); - VERIFY(rdata, attr_data5, "H5Aread"); - + /* Verify the floating-poing value in this way to avoid compiler warning. */ + if(!FLT_ABS_EQUAL(rdata,attr_data5)) + printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + "H5Aread", attr_data5, rdata, (int)__LINE__, __FILE__); + /* Get the attribute's dataspace */ sid = H5Aget_space(attr); CHECK(sid, FAIL, "H5Aget_space"); @@ -1316,7 +1319,7 @@ test_attr_mult_read(hid_t fapl) for(i=0; i<ATTR3_DIM1; i++) for(j=0; j<ATTR3_DIM2; j++) for(k=0; k<ATTR3_DIM3; k++) - if(attr_data3[i][j][k]!=read_data3[i][j][k]) + if(!DBL_ABS_EQUAL(attr_data3[i][j][k],read_data3[i][j][k])) TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n",__LINE__,i,j,k,attr_data3[i][j][k],i,j,k,read_data3[i][j][k]); /* Verify Name */ diff --git a/test/tgenprop.c b/test/tgenprop.c index c91a05c..ba60cee 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -646,7 +646,11 @@ test_genprop_basic_list(void) VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget"); ret = H5Pget(lid1,PROP2_NAME,&prop2_value); CHECK_I(ret, "H5Pget"); - VERIFY(prop2_value, *PROP2_DEF_VALUE, "H5Pget"); + /* Verify the floating-poing value in this way to avoid compiler warning. */ + if(!FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE)) + printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + "H5Pget", *PROP2_DEF_VALUE, prop2_value, (int)__LINE__, __FILE__); + /* Close list */ ret = H5Pclose(lid1); @@ -750,7 +754,11 @@ test_genprop_basic_list_prop(void) VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget"); ret = H5Pget(lid1,PROP2_NAME,&prop2_value); CHECK_I(ret, "H5Pget"); - VERIFY(prop2_value, *PROP2_DEF_VALUE, "H5Pget"); + /* Verify the floating-poing value in this way to avoid compiler warning. */ + if(!FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE)) + printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + "H5Pget", *PROP2_DEF_VALUE, prop2_value, (int)__LINE__, __FILE__); + /* Check values of temporary properties (set with regular values) */ ret = H5Pget(lid1,PROP3_NAME,&prop3_value); @@ -759,7 +767,10 @@ test_genprop_basic_list_prop(void) TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__); ret = H5Pget(lid1,PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); - VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget"); + /* Verify the floating-poing value in this way to avoid compiler warning. */ + if(!FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) + printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); /* Delete permanent property */ ret = H5Premove(lid1,PROP2_NAME); @@ -793,7 +804,10 @@ test_genprop_basic_list_prop(void) /* Check values of temporary properties (set with regular values) */ ret = H5Pget(lid1,PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); - VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget"); + /* Verify the floating-poing value in this way to avoid compiler warning. */ + if(!FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) + printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); /* Close list */ ret = H5Pclose(lid1); @@ -1192,7 +1206,10 @@ test_genprop_list_callback(void) VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget"); ret = H5Pget(lid1,PROP2_NAME,&prop2_value); CHECK_I(ret, "H5Pget"); - VERIFY(prop2_value, *PROP2_DEF_VALUE, "H5Pget"); + /* Verify the floating-poing value in this way to avoid compiler warning. */ + if(!FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE)) + printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + "H5Pget", *PROP2_DEF_VALUE, prop2_value, (int)__LINE__, __FILE__); /* Check values of temporary properties (set with regular values) */ ret = H5Pget(lid1,PROP3_NAME,&prop3_value); @@ -1201,7 +1218,10 @@ test_genprop_list_callback(void) TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__); ret = H5Pget(lid1,PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); - VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget"); + /* Verify the floating-poing value in this way to avoid compiler warning. */ + if(!FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) + printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); /* Verify get callback information for properties tracked */ VERIFY(prop1_cb_info.get_count, 1, "H5Pget"); diff --git a/test/th5s.c b/test/th5s.c index 661f582..a67d5a2 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1020,7 +1020,7 @@ test_h5s_chunk(void) /* Initialize float array */ for(i=0; i<50000; i++) for(j=0; j<3; j++) - chunk_data_flt[i][j]=(float)(i*2.5-j*100.3); + chunk_data_flt[i][j]=(float)((i+1)*2.5-j*100.3); status= H5Dwrite(dsetID,H5T_NATIVE_FLOAT,H5S_ALL,H5S_ALL,H5P_DEFAULT,chunk_data_flt); CHECK(status, FAIL, "H5Dwrite"); @@ -1055,7 +1055,8 @@ test_h5s_chunk(void) for(i=0; i<50000; i++) { for(j=0; j<3; j++) { - if(chunk_data_dbl[i][j]!=chunk_data_flt[i][j]) + /* Check if the two values are within 0.001% range. */ + if(!DBL_REL_EQUAL(chunk_data_dbl[i][j],chunk_data_flt[i][j], 0.00001)) TestErrPrintf("chunk_data_dbl[%d][%d]=%f, chunk_data_flt[%d][%d]=%f\n",i,j,chunk_data_dbl[i][j],i,j,chunk_data_flt[i][j]); } /* end for */ } /* end for */ diff --git a/test/tmisc.c b/test/tmisc.c index c11fede..31643ce 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2462,7 +2462,7 @@ test_misc14(void) /* Check data from first dataset */ ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(rdata!=data1) + if(DBL_ABS_EQUAL(rdata,data1)) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Unlink second dataset */ @@ -2476,7 +2476,7 @@ test_misc14(void) /* Verify the data from dataset #1 */ ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(rdata!=data1) + if(DBL_ABS_EQUAL(rdata,data1)) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Close first dataset */ @@ -2510,7 +2510,7 @@ test_misc14(void) /* Check data from second dataset */ ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(rdata!=data2) + if(DBL_ABS_EQUAL(rdata,data2)) TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); /* Unlink first dataset */ @@ -2524,7 +2524,7 @@ test_misc14(void) /* Verify the data from dataset #2 */ ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(rdata!=data2) + if(DBL_ABS_EQUAL(rdata,data2)) TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); /* Close second dataset */ @@ -2565,13 +2565,13 @@ test_misc14(void) /* Check data from first dataset */ ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(rdata!=data1) + if(DBL_ABS_EQUAL(rdata,data1)) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Check data from third dataset */ ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(rdata!=data3) + if(DBL_ABS_EQUAL(rdata,data3)) TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); /* Unlink second dataset */ @@ -2585,13 +2585,13 @@ test_misc14(void) /* Verify the data from dataset #1 */ ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(rdata!=data1) + if(DBL_ABS_EQUAL(rdata,data1)) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Verify the data from dataset #3 */ ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); - if(rdata!=data3) + if(DBL_ABS_EQUAL(rdata,data3)) TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); /* Close first dataset */ diff --git a/test/tvltypes.c b/test/tvltypes.c index a8bd4e5..d8941e5 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -803,7 +803,7 @@ test_vltypes_vlen_compound(void) TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i); continue; } /* end if */ - if(((s1 *)wdata[i].p)[j].f != ((s1 *)rdata[i].p)[j].f ) { + if(!FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) { TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f); continue; } /* end if */ @@ -948,7 +948,7 @@ rewrite_vltypes_vlen_compound(void) TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i); continue; } /* end if */ - if( ((s1 *)wdata[i].p)[j].f != ((s1 *)rdata[i].p)[j].f ) { + if(!FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) { TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f); continue; } /* end if */ @@ -1097,7 +1097,7 @@ test_vltypes_compound_vlen_vlen(void) TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ - if(wdata[i].f!=rdata[i].f) { + if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ @@ -1552,7 +1552,7 @@ test_vltypes_compound_vlen_atomic(void) TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ - if(wdata[i].f!=rdata[i].f) { + if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ @@ -1601,7 +1601,7 @@ test_vltypes_compound_vlen_atomic(void) /* Check data read in */ for(i=0; i<SPACE1_DIM1; i++) - if(rdata[i].i!=0 || rdata[i].f!=0.0 || rdata[i].v.len!=0 || rdata[i].v.p!=NULL) + if(rdata[i].i!=0 || !FLT_ABS_EQUAL(rdata[i].f,0.0) || rdata[i].v.len!=0 || rdata[i].v.p!=NULL) TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p); /* Write dataset to disk */ @@ -1618,7 +1618,7 @@ test_vltypes_compound_vlen_atomic(void) TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ - if(wdata[i].f!=rdata[i].f) { + if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ @@ -1770,7 +1770,7 @@ rewrite_vltypes_compound_vlen_atomic(void) TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ - if(wdata[i].f!=rdata[i].f) { + if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) { TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ |