summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2006-06-23 22:11:12 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2006-06-23 22:11:12 (GMT)
commit4dfad81062f0b195ee9fd10f0b4e5ba2f6056aeb (patch)
treedd1beab639cb485e8c4b785112f00081c4d7d321 /src
parent842895a79950c2d43958831991a97802bcd58431 (diff)
downloadhdf5-4dfad81062f0b195ee9fd10f0b4e5ba2f6056aeb.zip
hdf5-4dfad81062f0b195ee9fd10f0b4e5ba2f6056aeb.tar.gz
hdf5-4dfad81062f0b195ee9fd10f0b4e5ba2f6056aeb.tar.bz2
[svn-r12435] Purpose: Bug fix
Description: Mac OS 10.4 on PowerPC chip has some errors to convert (unsigned) long long to long double. When the bit sequences are 0x003ff..., 0x007fff..., 0x00ffff..., 0x01ffff..., 0x7fffff..., the converted values are twice as big as they should be. Solution: Detect the error in configure and disable the compiler conversion and test case. Platforms tested: h5committest, Mac OS 10.4, and fuss.
Diffstat (limited to 'src')
-rw-r--r--src/H5T.c4
-rw-r--r--src/H5Tconv.c4
-rw-r--r--src/H5Tpkg.h13
-rw-r--r--src/H5config.h.in4
4 files changed, 19 insertions, 6 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 2a1295e..b955b40 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1208,9 +1208,9 @@ H5T_init_interface(void)
/* From long long to floats */
status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T_conv_llong_float, H5AC_dxpl_id, FALSE);
status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T_conv_llong_double, H5AC_dxpl_id, FALSE);
-#if H5T_CONV_INTERNAL_INTEGER_LDOUBLE
+#if H5T_CONV_INTERNAL_LLONG_LDOUBLE
status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T_conv_llong_ldouble, H5AC_dxpl_id, FALSE);
-#endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */
+#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */
/* From unsigned long long to floats */
#if H5T_CONV_INTERNAL_ULLONG_FP
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index c05b3c1..dc56c30 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -8343,7 +8343,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-#if H5T_CONV_INTERNAL_INTEGER_LDOUBLE
+#if H5T_CONV_INTERNAL_LLONG_LDOUBLE
herr_t
H5T_conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
@@ -8359,7 +8359,7 @@ H5T_conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
done:
FUNC_LEAVE_NOAPI(ret_value);
}
-#endif /* H5T_CONV_INTERNAL_INTEGER_LDOUBLE */
+#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */
/*-------------------------------------------------------------------------
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 9a5ab33..ee0939e 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -99,6 +99,13 @@
#define H5T_CONV_INTERNAL_ULONG_LDOUBLE 1
#endif
+/* Define an internal macro for converting long long to long double. Mac OS 10.4 gives some
+ * incorrect conversions. */
+#if (H5_WANT_DATA_ACCURACY && H5_INTEGER_TO_LDOUBLE_ACCURATE && H5_LLONG_TO_LDOUBLE_CORRECT) || \
+ (!H5_WANT_DATA_ACCURACY)
+#define H5T_CONV_INTERNAL_LLONG_LDOUBLE 1
+#endif
+
/* Define an internal macro for converting unsigned long long to floating numbers. SGI compilers give
* some incorect conversion. 64-bit Solaris does different rounding. Windows Visual Studio 6 does
* not support unsigned long long. */
@@ -110,9 +117,11 @@
/* Define an internal macro for converting unsigned long long to long double. SGI compilers give
* some incorect conversion. 64-bit Solaris does different rounding. Windows Visual Studio 6 does
* not support unsigned long long. For FreeBSD(sleipnir), the last 2 bytes of mantissa are lost when
- * compiler tries to do the conversion. For Cygwin, compiler doesn't do rounding correctly. */
+ * compiler tries to do the conversion. For Cygwin, compiler doesn't do rounding correctly.
+ * Mac OS 10.4 gives some incorrect result. */
#if (H5_WANT_DATA_ACCURACY && H5_ULLONG_TO_FP_CAST_WORKS && H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE && \
- H5_ULLONG_TO_LDOUBLE_PRECISION) || (!H5_WANT_DATA_ACCURACY && H5_ULLONG_TO_FP_CAST_WORKS)
+ H5_ULLONG_TO_LDOUBLE_PRECISION && H5_LLONG_TO_LDOUBLE_CORRECT) || (!H5_WANT_DATA_ACCURACY && \
+ H5_ULLONG_TO_FP_CAST_WORKS)
#define H5T_CONV_INTERNAL_ULLONG_LDOUBLE 1
#endif
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 5497037..86e30f2 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -394,6 +394,10 @@
/* Define if your system can compile long long to floating-point casts. */
#undef LLONG_TO_FP_CAST_WORKS
+/* Define if your system can convert (unsigned) long long to long double
+ values correctly. */
+#undef LLONG_TO_LDOUBLE_CORRECT
+
/* Define if your system can handle complicated MPI derived datatype
correctly. */
#undef MPI_COMPLEX_DERIVED_DATATYPE_WORKS