diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2005-01-31 22:08:09 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2005-01-31 22:08:09 (GMT) |
commit | 593d0c490a05b9f35859969e24b583c79a414743 (patch) | |
tree | c891f9c14908b4159a40d624f419271d45a03d75 /test | |
parent | 3926845f87c72bf5348f6a73e627654fc5035645 (diff) | |
download | hdf5-593d0c490a05b9f35859969e24b583c79a414743.zip hdf5-593d0c490a05b9f35859969e24b583c79a414743.tar.gz hdf5-593d0c490a05b9f35859969e24b583c79a414743.tar.bz2 |
[svn-r9898] Purpose: Bug fix for test program
Description:
For Intel machines, the size of "long double" is 12 byte, precision
is 80 bits, mantissa size is 64 bits, and no normalization. So the
most significant bit of mantissa is always 1 unless the floating number
has special value. This step tries to compensate this case by turning
on the most significant bit of mantissa if the mantissa bits aren't
all 0s.
Solution:
Tries to compensate this case by turning on the most significant bit of
mantissa if the mantissa bits aren't all 0s.
Platforms tested: eirene and fuss(production enabled). Small change for
production only.
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index 36431f7..d7ada50 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -2458,7 +2458,7 @@ test_derived_flt(void) } if(H5Tset_precision(tid1, 42)<0) { H5_FAILED(); - printf("Can't set precision\n"); + printf("Can't set precision 1\n"); goto error; } if(H5Tset_size(tid1, 7)<0) { @@ -2618,7 +2618,7 @@ test_derived_flt(void) } if(H5Tset_precision(tid2, 24)<0) { H5_FAILED(); - printf("Can't set precision\n"); + printf("Can't set precision 2\n"); goto error; } if(H5Tset_size(tid2, 3)<0) { @@ -6111,9 +6111,23 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst) * will be used for the conversion while the `saved' buffer will be * used for the comparison later. */ - for (j=0; j<nelmts*src_size; j++) + for (j=0; j<nelmts*src_size; j++) { buf[j] = saved[j] = HDrand(); + /* For Intel machines, the size of "long double" is 12 byte, precision + * is 80 bits, mantissa size is 64 bits, and no normalization. So the + * most significant bit of mantissa is always 1 unless the floating number + * has special value. This step tries to compensate this case by turning + * on the most significant bit of mantissa if the mantissa bits aren't + * all 0s. */ + if(endian==H5T_ORDER_LE && src_type==FLT_LDOUBLE && src_size==12) { + if(j%12==7) { + buf[j] |= 0x80; + saved[j] |= 0x80; + } + } + } + /* Perform the conversion */ if (H5Tconvert(src, dst, nelmts, buf, NULL, dxpl_id)<0) goto error; |