summaryrefslogtreecommitdiffstats
path: root/tools/h5dump/h5dumpgentest.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-03-01 18:48:54 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-03-01 18:48:54 (GMT)
commitd8e3d8e9082f0926e80e7e7010c00bda05a215b3 (patch)
treebf7717a29d0938ab15e6f54ef981e5abfcf467a5 /tools/h5dump/h5dumpgentest.c
parentac290b5e45412a0a93fde620490d703c773d27d4 (diff)
downloadhdf5-d8e3d8e9082f0926e80e7e7010c00bda05a215b3.zip
hdf5-d8e3d8e9082f0926e80e7e7010c00bda05a215b3.tar.gz
hdf5-d8e3d8e9082f0926e80e7e7010c00bda05a215b3.tar.bz2
[svn-r26333] Eliminates gcc warnings due to -Wunsuffixed-float-constants.
- Adds 'F' suffixes for most float constants. - A few constants MUST be of type double. These now receive the long double L suffix and are then cast to double. I do this via a new H5_DOUBLE() macro which was added to H5private.h. Fixes: HDFFV-9148 Tested on: h5committest
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r--tools/h5dump/h5dumpgentest.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 36c9642..c04afe9 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -429,7 +429,7 @@ gent_dataset(void)
for(i = 0; i < 30; i++)
for(j = 0; j < 20; j++)
- dset2[i][j] = 0.0001 * j + i;
+ dset2[i][j] = 0.0001F * j + i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -524,7 +524,7 @@ gent_attribute(void)
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++) d[i] = 0.1 * i;
+ for(i = 0; i < 10; i++) d[i] = 0.1F * i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space);
@@ -952,16 +952,16 @@ static void gent_compound_dt(void) { /* test compound data type */
for(i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1./(i+1));
+ dset1[i].c = (float)(1.0F/(i+1));
dset2[i].a = i;
- dset2[i].b = (float)(i+ i*0.1);
+ dset2[i].b = (float)(i+ i*0.1F);
dset4[i].a = i;
dset4[i].b = (float)(i+3);
dset5[i].a = i;
- dset5[i].b = (float)(i*0.1);
+ dset5[i].b = (float)(i*0.1F);
}
@@ -1137,16 +1137,16 @@ static void gent_compound_dt2(void) { /* test compound data type */
for(i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1./(i+1));
+ dset1[i].c = (float)(1.0F/(i+1));
dset2[i].a = i;
- dset2[i].b = (float)(i+ i*0.1);
+ dset2[i].b = (float)(i+ i*0.1F);
dset4[i].a = i;
- dset4[i].b = (float)(i*1.0);
+ dset4[i].b = (float)(i*1.0F);
dset5[i].a = i;
- dset5[i].b = (float)(i*1.0);
+ dset5[i].b = (float)(i*1.0F);
}
fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1386,7 +1386,7 @@ static void gent_all(void)
space = H5Screate_simple(1, dims, NULL);
dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < 10; i++)
- dset2_1[i] = (float)(i * 0.1 + 1);
+ dset2_1[i] = (float)(i * 0.1F + 1);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
H5Sclose(space);
H5Dclose(dataset);
@@ -1397,7 +1397,7 @@ static void gent_all(void)
dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < 3; i++)
for(j = 0; j < 5; j++)
- dset2_2[i][j] = (float)((i + 1) * j * 0.1);
+ dset2_2[i][j] = (float)((i + 1) * j * 0.1F);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
H5Sclose(space);
H5Dclose(dataset);
@@ -1565,7 +1565,7 @@ gent_many(void)
space2 = H5Screate_simple(1, dims, NULL);
attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < 10; i++)
- d[i] = 0.1 * i;
+ d[i] = 0.1F * i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space2);
H5Aclose(attr);
@@ -2378,10 +2378,10 @@ static void gent_nestcomp(void)
for(i = 0; i< 10; i++) {
s1[i].a = i;
s1[i].b = (float)(i*i);
- s1[i].c = 1./(i+1);
+ s1[i].c = 1.0F/(i+1);
s1[i].d.a = 65 + i;
- s1[i].d.b[0] = -100.;
- s1[i].d.b[1] = 100.;
+ s1[i].d.b[0] = -100.0F;
+ s1[i].d.b[1] = 100.0F;
}
/*
@@ -2582,7 +2582,7 @@ static void gent_vldatatypes(void)
wdata[i].len = i + 1;
for(j = 0; j < i + 1; j++)
- ((float *)wdata[i].p)[j] = (float)(i * 10 + ((float)j) / 10.0);
+ ((float *)wdata[i].p)[j] = (float)(i * 10 + ((float)j) / 10.0F);
}
/* write out the floats in little-endian format */
@@ -2716,7 +2716,7 @@ static void gent_vldatatypes3(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0);
+ wdata[i].f=(float)((i*20)/3.0F);
wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int));
wdata[i].v.len=i+1;
for(j=0; j<(i+1); j++)
@@ -2788,7 +2788,7 @@ static void gent_vldatatypes4(void)
wdata[i].len=i+1;
for(j=0; j<(i+1); j++) {
((s1 *)wdata[i].p)[j].i=i*10+j;
- ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0);
+ ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F);
} /* end for */
} /* end for */
@@ -3159,7 +3159,7 @@ static void gent_array4(void)
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
wdata[i][j].i=i*10+j;
- wdata[i][j].f=(float)(i*2.5+j);
+ wdata[i][j].f=(float)(i*2.5F+j);
} /* end for */
/* Create file */
@@ -3227,7 +3227,7 @@ static void gent_array5(void)
for(j=0; j<ARRAY1_DIM1; j++) {
wdata[i][j].i=i*10+j;
for(k=0; k<ARRAY1_DIM1; k++)
- wdata[i][j].f[k]=(float)(i*10+j*2.5+k);
+ wdata[i][j].f[k]=(float)(i*10+j*2.5F+k);
} /* end for */
/* Create file */
@@ -4933,10 +4933,10 @@ static void gent_compound_complex(void)
}
}
- Array1[m].e = (float)( m * .96 );
+ Array1[m].e = (float)( m * 0.96F );
for(n = 0; n < F41_ARRAY_DIMf; n++) {
- Array1[m].f[n] = ( m * 1024.9637 );
+ Array1[m].f[n] = ( m * 1024.9637F );
}
Array1[m].g = 'm';
@@ -6873,7 +6873,7 @@ gent_fpformat(void)
{
hid_t fid, sid, did;
hsize_t dims[1] = {6};
- double dbuf[6] = {-0.1234567, 0.1234567, 0, 0, 0, 0};
+ double dbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
fid = H5Fcreate(FILE60, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -7193,7 +7193,7 @@ gent_packedbits(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001 * j + i;
+ dsetdbl[i][j] = 0.0001F * j + i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -7383,7 +7383,7 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001 * j + i;
+ dsetdbl[i][j] = 0.0001F * j + i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl);
@@ -7591,7 +7591,7 @@ static void gent_compound_intsizes(void) {
for(n = 0; n < dims[0]; n++)
for(o = 0; o < dims[1]; o++)
- Array1[m].dsetdbl[n][o] = 0.0001 * o + n;
+ Array1[m].dsetdbl[n][o] = 0.0001F * o + n;
}
/* Create the array data type for the 8 bits signed int array */
@@ -7866,7 +7866,7 @@ static void gent_compound_attr_intsizes(void) {
for(n = 0; n < dims[0]; n++)
for(o = 0; o < dims[1]; o++)
- Array1[m].dsetdbl[n][o] = 0.0001 * o + n;
+ Array1[m].dsetdbl[n][o] = 0.0001F * o + n;
}
/* Create the array data type for the 8 bits signed int array */
@@ -8034,17 +8034,17 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
dset1[i].b = (float)(i*i);
dset2[i].a = i;
- dset2[i].b = (float)(i+i*0.1);
+ dset2[i].b = (float)(i+i*0.1F);
dset2[i].c = GREEN;
for(j = 0; j < 5; j++) {
dset3[i].a[j] = i*j;
for(k = 0; k < 6; k++) {
- dset3[i].b[j][k] = (float)(i*j*k*1.0);
+ dset3[i].b[j][k] = (float)(i*j*k*1.0F);
}
}
dset3[i].c.a = i;
- dset3[i].c.b = (float)(i*1.0);
+ dset3[i].c.b = (float)(i*1.0F);
}
fid = H5Fcreate(FILE72, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -8332,7 +8332,7 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001 * j + i;
+ dsetdbl[i][j] = 0.0001F * j + i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -8531,7 +8531,7 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001 * j + i;
+ dsetdbl[i][j] = 0.0001F * j + i;
H5Awrite(attr, tid, dsetdbl);
@@ -8717,7 +8717,7 @@ static void gent_compound_int_array(void) {
dims[0] = F76_DIM8;
for(n = 0; n < dims[0]; n++)
- Cmpd1[m].dsetdbl[n] = 0.0001 + n;
+ Cmpd1[m].dsetdbl[n] = 0.0001F + n;
}
/* Create the array data type for the 8 bits signed int array */
@@ -8948,8 +8948,8 @@ static void gent_compound_ints(void) {
val64bits <<= 1;
/* Double Dummy set for failure tests */
- Cmpd1[m].dsetdbl = 0.0001 + m;
- Cmpd2[m].dsetdbl = 0.0001 + m;
+ Cmpd1[m].dsetdbl = 0.0001F + m;
+ Cmpd2[m].dsetdbl = 0.0001F + m;
}
/* Create the dataspace */
@@ -9286,7 +9286,7 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001 * j + i;
+ dsetdbl[i][j] = 0.0001F * j + i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
/* Attribute of double */
@@ -9551,7 +9551,7 @@ gent_intsattrs(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++) {
- dsetdbl[i][j] = 0.0001 * j + i;
+ dsetdbl[i][j] = 0.0001F * j + i;
asetdbl[i*dims[1]+j] = dsetdbl[i][j];
}