[Python-checkins] r62447 - in python/trunk: configure configure.in pyconfig.h.in
mark.dickinson
python-checkins at python.org
Tue Apr 22 00:32:38 CEST 2008
Author: mark.dickinson
Date: Tue Apr 22 00:32:24 2008
New Revision: 62447
Log:
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
Modified:
python/trunk/configure
python/trunk/configure.in
python/trunk/pyconfig.h.in
Modified: python/trunk/configure
==============================================================================
--- python/trunk/configure (original)
+++ python/trunk/configure Tue Apr 22 00:32:24 2008
@@ -20851,6 +20851,82 @@
# ************************************
# * Check for mathematical functions *
# ************************************
+
+# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
+# -0. on some architectures.
+{ echo "$as_me:$LINENO: checking whether tanh preserves the sign of zero" >&5
+echo $ECHO_N "checking whether tanh preserves the sign of zero... $ECHO_C" >&6; }
+if test "${ac_cv_tanh_preserves_zero_sign+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+if test "$cross_compiling" = yes; then
+ ac_cv_tanh_preserves_zero_sign=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <math.h>
+int main() {
+ /* return 0 if either negative zeros don't exist
+ on this platform or if negative zeros exist
+ and tanh(-0.) == -0. */
+ if (atan2(0., -1.) == atan2(-0., -1.) ||
+ atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
+ else exit(1);
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_tanh_preserves_zero_sign=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_tanh_preserves_zero_sign=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_cv_tanh_preserves_zero_sign" >&5
+echo "${ECHO_T}$ac_cv_tanh_preserves_zero_sign" >&6; }
+if test "$ac_cv_tanh_preserves_zero_sign" = yes
+then
+
+cat >>confdefs.h <<\_ACEOF
+#define TANH_PRESERVES_ZERO_SIGN 1
+_ACEOF
+
+fi
+
LIBS_SAVE=$LIBS
LIBS="$LIBS $LIBM"
Modified: python/trunk/configure.in
==============================================================================
--- python/trunk/configure.in (original)
+++ python/trunk/configure.in Tue Apr 22 00:32:24 2008
@@ -2994,6 +2994,32 @@
# ************************************
# * Check for mathematical functions *
# ************************************
+
+# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
+# -0. on some architectures.
+AC_MSG_CHECKING(whether tanh preserves the sign of zero)
+AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
+AC_TRY_RUN([
+#include <math.h>
+int main() {
+ /* return 0 if either negative zeros don't exist
+ on this platform or if negative zeros exist
+ and tanh(-0.) == -0. */
+ if (atan2(0., -1.) == atan2(-0., -1.) ||
+ atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
+ else exit(1);
+}
+],
+ac_cv_tanh_preserves_zero_sign=yes,
+ac_cv_tanh_preserves_zero_sign=no,
+ac_cv_tanh_preserves_zero_sign=no)])
+AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
+if test "$ac_cv_tanh_preserves_zero_sign" = yes
+then
+ AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
+ [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
+fi
+
LIBS_SAVE=$LIBS
LIBS="$LIBS $LIBM"
AC_REPLACE_FUNCS(hypot)
Modified: python/trunk/pyconfig.h.in
==============================================================================
--- python/trunk/pyconfig.h.in (original)
+++ python/trunk/pyconfig.h.in Tue Apr 22 00:32:24 2008
@@ -921,6 +921,9 @@
(which you can't on SCO ODT 3.0). */
#undef SYS_SELECT_WITH_SYS_TIME
+/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */
+#undef TANH_PRESERVES_ZERO_SIGN
+
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
More information about the Python-checkins
mailing list