summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-03-25 17:53:19 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-03-25 17:53:19 (GMT)
commit705b9ec0c98ee78acbe4824c482f23b284dbd190 (patch)
tree598c67fc9b772163613235dadb63de855c3b4c51 /test
parent9b6ef54469382a84ba2c4c75f1c6c919bdf2bfac (diff)
downloadhdf5-705b9ec0c98ee78acbe4824c482f23b284dbd190.zip
hdf5-705b9ec0c98ee78acbe4824c482f23b284dbd190.tar.gz
hdf5-705b9ec0c98ee78acbe4824c482f23b284dbd190.tar.bz2
[svn-r10445] Purpose: Bug fix
Description: In test_conv_flt_1() in dtypes.c, the case of Intel-Linux or AMD-Linux "long double" wasn't considered. The precision is smaller than the size. There may be some garbage left in the unused bytes during hardware conversion. Solution: Clear those bytes before comparison. Platforms tested: h5committest and mir, modi4.
Diffstat (limited to 'test')
-rw-r--r--test/dtypes.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index 5cac6e8..911bba0 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -6038,9 +6038,23 @@ test_conv_flt_1 (const char *name, hbool_t run_special, hid_t src, hid_t dst)
uflow++;
}
+ /* For Intel machines, the size of "long double" is 12 bytes, precision
+ * is 80 bits; for Intel IA64 and AMD processors, the size of "long double"
+ * is 16 bytes, precision is 80 bits. During hardware conversion, the
+ * last few unused bytes may have garbage in them. Clean them out with
+ * 0s before compare the values.
+ */
+ if(endian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE) {
+ int q;
+ for(q=dst_nbits/8; q<dst_size; q++) {
+ buf[j*dst_size+q] = 0x00;
+ hw[q] = 0x00;
+ }
+ }
+
/* Are the two results the same? */
- for (k=0; k<dst_size; k++)
- if (buf[j*dst_size+k]!=hw[k])
+ for (k=(dst_size-(dst_nbits/8)); k<dst_size; k++)
+ if (buf[j*dst_size+k]!=hw[k])
break;
if (k==dst_size)
continue; /*no error*/
@@ -6905,7 +6919,7 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
*/
if(endian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE) {
int q;
- for(q=10; q<dst_size; q++) {
+ for(q=dst_nbits/8; q<dst_size; q++) {
buf[j*dst_size+q] = 0x00;
}
}