[PPL-devel] [GIT] ppl/ppl(master): Detect bogus versions of std::floor(long double).

Roberto Bagnara roberto.bagnara at bugseng.com
Mon Nov 12 09:33:57 CET 2012


Module: ppl/ppl
Branch: master
Commit: ec6f51a39abaa212a28f1a34c912f02a24d2e4ea
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=ec6f51a39abaa212a28f1a34c912f02a24d2e4ea

Author: Roberto Bagnara <roberto.bagnara at bugseng.com>
Date:   Mon Nov 12 09:31:19 2012 +0100

Detect bogus versions of std::floor(long double).

---

 configure.ac                           |    2 +-
 m4/ac_cxx_long_double_binary_format.m4 |   25 ++++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5dc2877..bc1b7da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@
 # Process this file with Autoconf to produce a configure script.
 
 # Every other copy of the package version number gets its value from here.
-AC_INIT([the Parma Polyhedra Library], [1.1pre4], [ppl-devel at cs.unipr.it], [ppl])
+AC_INIT([the Parma Polyhedra Library], [1.1pre5], [ppl-devel at cs.unipr.it], [ppl])
 
 # Minimum Autoconf version required.
 AC_PREREQ(2.61)
diff --git a/m4/ac_cxx_long_double_binary_format.m4 b/m4/ac_cxx_long_double_binary_format.m4
index 588d4b3..53a6e36 100644
--- a/m4/ac_cxx_long_double_binary_format.m4
+++ b/m4/ac_cxx_long_double_binary_format.m4
@@ -314,7 +314,30 @@ fi
 
 AC_MSG_RESULT($ac_cxx_long_double_binary_format)
 
-if test x"$ac_cxx_long_double_binary_format" = x"unknown" || test $ac_cv_can_control_fpu = 0
+AC_MSG_CHECKING([whether std::floor(long double) is buggy])
+AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <cmath>
+#include <cstdlib>
+
+long double x = 13311002825915415087.0L;
+
+int main() {
+  long double y = std::floor(x);
+  if (x != y)
+    return 1;
+  else
+    return 0;
+}
+  ]])],
+  ac_std_floor_long_double_is_buggy=no
+  AC_MSG_RESULT(no),
+  ac_std_floor_long_double_is_buggy=yes
+  AC_MSG_RESULT(yes),
+  ac_std_floor_long_double_is_buggy=no
+  AC_MSG_RESULT([assuming is not]))
+
+if test x"$ac_cxx_long_double_binary_format" = x"unknown" \
+|| test $ac_cv_can_control_fpu = 0 \
+|| test x"$ac_std_floor_long_double_is_buggy" = x"yes"
 then
   ac_supported_long_double=0
 else




More information about the PPL-devel mailing list