summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-01-08 20:14:59 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-01-08 20:14:59 (GMT)
commit28b47d461f9d2d3865c369872c8f368b056681d2 (patch)
tree4070d94bde5bd222d7a1bb434e74bb9434560f9c /tools/h5diff
parent95a801714bdfbc93efc7e3f70cd0b6ea872bb6db (diff)
downloadhdf5-28b47d461f9d2d3865c369872c8f368b056681d2.zip
hdf5-28b47d461f9d2d3865c369872c8f368b056681d2.tar.gz
hdf5-28b47d461f9d2d3865c369872c8f368b056681d2.tar.bz2
[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
Diffstat (limited to 'tools/h5diff')
-rw-r--r--tools/h5diff/h5diffgentest.c72
1 files changed, 71 insertions, 1 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 51e0a83..d1219e8 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -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