diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2004-05-11 20:26:21 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2004-05-11 20:26:21 (GMT) |
commit | 44cb906eb77e050c6187152592fa5418eba6e075 (patch) | |
tree | e68b3db2a55672042ef79535adbb57712dc0a3a6 /configure.in | |
parent | 60ae885fd1d3fad67970dcf2c86f784ba36a3b4d (diff) | |
download | hdf5-44cb906eb77e050c6187152592fa5418eba6e075.zip hdf5-44cb906eb77e050c6187152592fa5418eba6e075.tar.gz hdf5-44cb906eb77e050c6187152592fa5418eba6e075.tar.bz2 |
[svn-r8504] Purpose: bug fix
Description: The HP compiler cannot convert from float-point numbers to unsigned long long
correctly. It sets the maximal value of unsigned long long as 0x7fffffffffffffff.
Solution: Skip the conversion test when this happens by testing it during configuration.
Platforms tested: kelgia(HP-UX 11) and fuss(RH 8)
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/configure.in b/configure.in index 905f1ee..b42878d 100644 --- a/configure.in +++ b/configure.in @@ -2471,21 +2471,21 @@ dnl (This flag should be set for all machines, except for PGI compiler dnl where round-up happens when the fraction of float-point value is greater dnl than 0.5. dnl -AC_MSG_CHECKING([if accurately converting floating-point to unsigned long long values works]) +AC_MSG_CHECKING([if accurately roundup converting floating-point to unsigned long long values]) AC_CACHE_VAL([hdf5_cv_fp_to_ullong_bottom_bit_works], [AC_TRY_RUN([ int main(void) { - float f = 111.60; + float f = 111.60; double d = 222.55; unsigned long long l1 = (unsigned long long)f; unsigned long long l2 = (unsigned long long)d; int ret = 0; - if(l1 == 112) + if(l1 == 112) ret = 1; - if(l2 == 223) + if(l2 == 223) ret = 1; done: @@ -2495,13 +2495,50 @@ done: if test ${hdf5_cv_fp_to_ullong_bottom_bit_works} = "yes"; then AC_DEFINE([FP_TO_ULLONG_BOTTOM_BIT_WORKS], [1], - [Define if your system can accurately convert floating-point to unsigned long long values.]) + [Define if your system roundup accurately convert floating-point to unsigned long long values.]) AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi dnl ---------------------------------------------------------------------- +dnl Set the flag to indicate that the machine can accurately convert +dnl 'float' or 'double' to 'unsigned (long) long' values. +dnl (This flag should be set for all machines, except for HP-UX machines +dnl where the maximal number for unsigned long long is 0x7fffffffffffffff +dnl during conversion. +dnl +AC_MSG_CHECKING([if right maximum converting floating-point to unsigned long long values]) + +AC_CACHE_VAL([hdf5_cv_fp_to_ullong_right_maximum], + [AC_TRY_RUN([ + int main(void) + { + float f = 9701917572145405952.00f; + double d = 9701917572145405952.00; + unsigned long long l1 = (unsigned long long)f; + unsigned long long l2 = (unsigned long long)d; + unsigned long long l3 = 0x7fffffffffffffffLLU; + int ret = 0; + + if(l1 <= l3 || l2 <= l3) + ret = 1; + +done: + exit(ret); + } + ], [hdf5_cv_fp_to_ullong_right_maximum=yes], [hdf5_cv_fp_to_ullong_right_maximum=no],)]) + +if test ${hdf5_cv_fp_to_ullong_right_maximum} = "yes"; then + AC_DEFINE([FP_TO_ULLONG_RIGHT_MAXIMUM], [1], + [Define if your system has right maximum convert floating-point to unsigned long long values.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + + +dnl ---------------------------------------------------------------------- dnl Set the flag to indicate that the machine can _compile_ dnl 'unsigned long long' to 'float' and 'double' typecasts. dnl (This flag should be set for all machines, except for under Windows when |