diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2005-01-11 18:17:01 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2005-01-11 18:17:01 (GMT) |
commit | a985c4c52596924c1cb5020ac514163c46e4ff79 (patch) | |
tree | f210749d5adec2791265434da4e3e765ebc877b1 /test | |
parent | 76ba1a99d30f5808b08214ef07019672694b73da (diff) | |
download | hdf5-a985c4c52596924c1cb5020ac514163c46e4ff79.zip hdf5-a985c4c52596924c1cb5020ac514163c46e4ff79.tar.gz hdf5-a985c4c52596924c1cb5020ac514163c46e4ff79.tar.bz2 |
[svn-r9807] Purpose: bug fix
Description: For FreeBSD (sleipnir), when GNU compilers do conversion from
unsigned long long to long double, the last 2 bytes of mantissa are lost.
The impact of precision loss isn't significant.
Solution: Detect this case on FreeBSD in configure, ignore it in dtypes.c
test instead of return failure.
Platforms tested: sleipnir, fuss, modi4. These systems are mainly concerned.
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index dd94193..c6d6a57 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -5849,6 +5849,21 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst) } #endif /*end H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS*/ +/* 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. + */ +#ifndef H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS + if(src_type==INT_ULLONG && dst_type==FLT_LDOUBLE) { + long double tmp_s, tmp_h; + 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)) + continue; /*no error*/ + } +#endif /*end H5_ULLONG_TO_LDOUBLE_PRECISION_WORKS*/ + /* Print errors */ if (0==fails_this_test++) H5_FAILED(); |