mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-24 15:25:00 +08:00
[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.
This commit is contained in:
parent
9b6ef54469
commit
705b9ec0c9
@ -6038,9 +6038,23 @@ test_conv_flt_1 (const char *name, hbool_t run_special, hid_t src, hid_t dst)
|
|||||||
uflow++;
|
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? */
|
/* Are the two results the same? */
|
||||||
for (k=0; k<dst_size; k++)
|
for (k=(dst_size-(dst_nbits/8)); k<dst_size; k++)
|
||||||
if (buf[j*dst_size+k]!=hw[k])
|
if (buf[j*dst_size+k]!=hw[k])
|
||||||
break;
|
break;
|
||||||
if (k==dst_size)
|
if (k==dst_size)
|
||||||
continue; /*no error*/
|
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) {
|
if(endian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE) {
|
||||||
int q;
|
int q;
|
||||||
for(q=10; q<dst_size; q++) {
|
for(q=dst_nbits/8; q<dst_size; q++) {
|
||||||
buf[j*dst_size+q] = 0x00;
|
buf[j*dst_size+q] = 0x00;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user