diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-07-24 12:07:44 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-07-24 12:07:44 +0000 |
commit | fdf3e83a2a4ec1ea789e0c8a2d4c45798ed4610f (patch) | |
tree | 585944a4732e3a23592dd730eb4bd365759bb675 /acinclude.m4 | |
parent | 42b244aa8419cc5af8d7a84f2a4249958b64909f (diff) | |
download | mpfr-fdf3e83a2a4ec1ea789e0c8a2d4c45798ed4610f.tar.gz |
[acinclude.m4] added test for double-to-integer conversion bug
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8353 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 264f6b5bb..63611316a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -222,6 +222,32 @@ static double get_max (void) { static volatile double d = DBL_MAX; return d; } fi fi +dnl Check for double-to-integer conversion bug +dnl https://gforge.inria.fr/tracker/index.php?func=detail&aid=14435 +AC_MSG_CHECKING(for double-to-integer conversion bug) +AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include "gmp.h" +]], [[ + double d; + mp_limb_t u; + int i; + + d = 1.0; + for (i = 0; i < GMP_NUMB_BITS - 1; i++) + d = d + d; + u = (mp_limb_t) d; + for (; i > 0; i--) + { + if (u & 1) + break; + u = u >> 1; + } + return (i == 0 && u == 1UL) ? 0 : 1; +]])], [AC_MSG_RESULT(no)], [ + AC_MSG_RESULT(yes) + AC_MSG_ERROR([double-to-integer conversion is incorrect. +You need to use another compiler (or disable optimization).])]) + dnl Check if subnormal (denormalized) numbers are supported AC_CACHE_CHECK([for subnormal numbers], mpfr_cv_have_denorms, [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ |