diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2005-01-12 20:40:36 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2005-01-12 20:40:36 (GMT) |
commit | 524830d67eb640e75d2dbaf85e3e863ff9643564 (patch) | |
tree | 7cd13aaa651599e586bdb8b8f38298faea573aac /test | |
parent | 39b18b8e0fb1b7d19a178a31ac16b1baaf113d98 (diff) | |
download | hdf5-524830d67eb640e75d2dbaf85e3e863ff9643564.zip hdf5-524830d67eb640e75d2dbaf85e3e863ff9643564.tar.gz hdf5-524830d67eb640e75d2dbaf85e3e863ff9643564.tar.bz2 |
[svn-r9814] Purpose: Bug fix
Description: the last 2 bytes of mantissa can be lost when converting from unsigned long long
to long double. In last check-in, a fix was made to ignore that precision loss. But sometimes,
the last 2 bytes are rounded up to the 3rd last byte.
Solution: Ignore the 3rd last byte, too, when comparing values.
Platforms tested: sleipnir - only this system is concerned.
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index c6d6a57..684ed19 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -5851,7 +5851,8 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst) /* For GNU compilers on FreeBSD(sleipnir), during conversion from 'unsigned long long' * to 'long double', the last 2 bytes of mantissa are lost. But this loss seems - * acceptable. We allow it go through instead of fail it. + * acceptable. We allow it to go through instead of fail it. Sometimes, there's roundup + * to the 3rd last byte of mantissa. So we only try to compare all but the last 3 bytes. */ #ifndef H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS if(src_type==INT_ULLONG && dst_type==FLT_LDOUBLE) { @@ -5859,7 +5860,7 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst) HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(long double)); HDmemcpy(&tmp_h,&hw[0],sizeof(long double)); /*Don't compare the last 2 bytes of mantissa*/ - if(!HDmemcmp(&tmp_s+2, &tmp_h+2, sizeof(long double)-2)) + if(!HDmemcmp(&tmp_s+3, &tmp_h+3, sizeof(long double)-3)) continue; /*no error*/ } #endif /*end H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS*/ |