mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
[svn-r14382] bug fix: enable NaN detection for double type
note: RFC at http://www.hdfgroup.uiuc.edu/RFC/HDF5/NaNs_and_HDF5/ tested: windows, linux, solaris
This commit is contained in:
parent
95a801714b
commit
28b47d461f
@ -249,10 +249,12 @@ int test_basic(const char *fname1,
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* NaNs in floating point
|
||||
* NaNs in H5T_NATIVE_FLOAT
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
|
||||
#if 1
|
||||
float data15[6];
|
||||
float data16[6];
|
||||
|
||||
@ -272,10 +274,78 @@ int test_basic(const char *fname1,
|
||||
|
||||
write_dset(gid1,1,dims1,"fp15",H5T_NATIVE_FLOAT,data15);
|
||||
write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16);
|
||||
#else
|
||||
|
||||
|
||||
#define NU_ELMTS 1000000
|
||||
|
||||
hsize_t i;
|
||||
|
||||
hsize_t dims2[1] = { NU_ELMTS };
|
||||
|
||||
float *data15 = malloc (NU_ELMTS * sizeof(float) );
|
||||
float *data16 = malloc (NU_ELMTS * sizeof(float) );
|
||||
|
||||
data15[0] = (float) sqrt( (double)-1 );
|
||||
data15[1] = 1;
|
||||
data15[2] = (float) sqrt( (double)-1 );
|
||||
data15[3] = 1;
|
||||
data15[4] = 1;
|
||||
data15[5] = 1;
|
||||
|
||||
data16[0] = (float) sqrt( (double)-1 );
|
||||
data16[1] = (float) sqrt( (double)-1 );
|
||||
data16[2] = 1;
|
||||
data16[3] = 1;
|
||||
data16[4] = 1;
|
||||
data16[5] = 1;
|
||||
|
||||
for ( i = 6; i < NU_ELMTS; i++ )
|
||||
{
|
||||
data15[i] = /*data15[0];*/ 2;
|
||||
data16[i] = 1;
|
||||
}
|
||||
|
||||
write_dset(gid1,1,dims2,"fp15",H5T_NATIVE_FLOAT,data15);
|
||||
write_dset(gid1,1,dims2,"fp16",H5T_NATIVE_FLOAT,data16);
|
||||
|
||||
free( data15 );
|
||||
free( data16 );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* NaNs in H5T_NATIVE_DOUBLE
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
|
||||
double data17[6];
|
||||
double data18[6];
|
||||
|
||||
data17[0] = sqrt( (double)-1 );
|
||||
data17[1] = 1;
|
||||
data17[2] = sqrt( (double)-1 );
|
||||
data17[3] = 1;
|
||||
data17[4] = 1;
|
||||
data17[5] = 1;
|
||||
|
||||
data18[0] = (float) sqrt( (double)-1 );
|
||||
data18[1] = (float) sqrt( (double)-1 );
|
||||
data18[2] = 1;
|
||||
data18[3] = 1;
|
||||
data18[4] = 1;
|
||||
data18[5] = 1;
|
||||
|
||||
write_dset(gid1,1,dims1,"fp17",H5T_NATIVE_DOUBLE,data17);
|
||||
write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* close
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user