summaryrefslogtreecommitdiffstats
path: root/test/dt_arith.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2006-06-20 14:45:37 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2006-06-20 14:45:37 (GMT)
commit823fbd0e885aa28aafb17746c8040a3c65fbb893 (patch)
treed5e12f73e08e6909883513a79d9de9da43806277 /test/dt_arith.c
parent9db9e82cd1c4e35c6e64fbb2da5eb1db95a0fb55 (diff)
downloadhdf5-823fbd0e885aa28aafb17746c8040a3c65fbb893.zip
hdf5-823fbd0e885aa28aafb17746c8040a3c65fbb893.tar.gz
hdf5-823fbd0e885aa28aafb17746c8040a3c65fbb893.tar.bz2
[svn-r12425] Purpose: Bug fix
Description: Data conversion from long double to (unsigned) long long returns some incorrect values on Mac OS 10.4 and SGI IRIX64 6.5. The conversions start to go wrong when the long double is 20041683600089727.779961 (0x4351ccf385ebc8a0bfcc2a...). If adjusting the values higher by assigning 0x...c8a0cf... or 0x...c8a0df..., the converted values go wild. Solution: Detect this error in configure.in and disable compiler conversions from long double to (unsigned) long long for Mac OS 10.4 and IRIX64 6.5. Platforms tested: h5committest, Mac OS 10.4, and IRIX64 6.5.
Diffstat (limited to 'test/dt_arith.c')
-rw-r--r--test/dt_arith.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 2df3fd9..5569446 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -5120,10 +5120,26 @@ run_fp_int_conv(const char *name)
#endif
#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG && H5_SIZEOF_LONG_DOUBLE!=0
+#ifdef H5_LDOUBLE_TO_LLONG_ACCURATE
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG);
-#ifdef H5_FP_TO_ULLONG_RIGHT_MAXIMUM
+#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
+ {
+ char str[256]; /*string */
+
+ sprintf(str, "Testing %s %s -> %s conversions",
+ name, "long double", "long long");
+ printf("%-70s", str);
+ SKIPPED();
+#if H5_SIZEOF_LONG_DOUBLE!=0
+ HDputs(" Test skipped due to hardware conversion error.");
+#else
+ HDputs(" Test skipped due to disabled long double.");
+#endif
+ }
+#endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
+#if H5_FP_TO_ULLONG_RIGHT_MAXIMUM && H5_LDOUBLE_TO_LLONG_ACCURATE
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG);
-#else /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
+#else /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM && H5_LDOUBLE_TO_LLONG_ACCURATE*/
{
char str[256]; /*string */
@@ -5137,7 +5153,7 @@ run_fp_int_conv(const char *name)
HDputs(" Test skipped due to disabled long double.");
#endif
}
-#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
+#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM && H5_LDOUBLE_TO_LLONG_ACCURATE*/
#endif
#endif
#else /*H5_LDOUBLE_TO_INTEGER_WORKS && H5_LDOUBLE_TO_INTEGER_ACCURATE*/