[Python-checkins] r71710 - in python/trunk: Include/pymath.h Python/pymath.c configure configure.in pyconfig.h.in

mark.dickinson python-checkins at python.org
Sat Apr 18 16:41:37 CEST 2009


Author: mark.dickinson
Date: Sat Apr 18 16:41:37 2009
New Revision: 71710
Log:
Backport r71704 (add configure check for C99 round function) to trunk.
Modified:
 python/trunk/Include/pymath.h
 python/trunk/Python/pymath.c
 python/trunk/configure
 python/trunk/configure.in
 python/trunk/pyconfig.h.in
Modified: python/trunk/Include/pymath.h
==============================================================================
--- python/trunk/Include/pymath.h	(original)
+++ python/trunk/Include/pymath.h	Sat Apr 18 16:41:37 2009
@@ -22,6 +22,10 @@
 extern double copysign(double, double);
 #endif
 
+#ifndef HAVE_ROUND
+extern double round(double);
+#endif
+
 #ifndef HAVE_ACOSH
 extern double acosh(double);
 #endif
Modified: python/trunk/Python/pymath.c
==============================================================================
--- python/trunk/Python/pymath.c	(original)
+++ python/trunk/Python/pymath.c	Sat Apr 18 16:41:37 2009
@@ -47,6 +47,19 @@
 }
 #endif /* HAVE_COPYSIGN */
 
+#ifndef HAVE_ROUND
+double
+round(double x)
+{
+ double absx, y;
+ absx = fabs(x);
+ y = floor(absx);
+ if (absx - y >= 0.5)
+ y += 1.0;
+ return copysign(y, x);
+}
+#endif /* HAVE_ROUND */
+
 #ifndef HAVE_LOG1P
 #include <float.h>
 
Modified: python/trunk/configure
==============================================================================
--- python/trunk/configure	(original)
+++ python/trunk/configure	Sat Apr 18 16:41:37 2009
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 70903 .
+# From configure.in Revision: 71009 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 2.7.
 #
@@ -22169,7 +22169,8 @@
 
 
 
-for ac_func in acosh asinh atanh copysign expm1 finite hypot log1p
+
+for ac_func in acosh asinh atanh copysign expm1 finite hypot log1p round
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
Modified: python/trunk/configure.in
==============================================================================
--- python/trunk/configure.in	(original)
+++ python/trunk/configure.in	Sat Apr 18 16:41:37 2009
@@ -3250,7 +3250,7 @@
 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
 fi
 
-AC_CHECK_FUNCS([acosh asinh atanh copysign expm1 finite hypot log1p])
+AC_CHECK_FUNCS([acosh asinh atanh copysign expm1 finite hypot log1p round])
 AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
 
 LIBS=$LIBS_SAVE
Modified: python/trunk/pyconfig.h.in
==============================================================================
--- python/trunk/pyconfig.h.in	(original)
+++ python/trunk/pyconfig.h.in	Sat Apr 18 16:41:37 2009
@@ -504,6 +504,9 @@
 /* Define if you have readline 4.0 */
 #undef HAVE_RL_PRE_INPUT_HOOK
 
+/* Define to 1 if you have the `round' function. */
+#undef HAVE_ROUND
+
 /* Define to 1 if you have the `select' function. */
 #undef HAVE_SELECT
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /