From 10e1bf2f64b77f3a71157c72de19265870cdeb5f Mon Sep 17 00:00:00 2001 From: Peter Schneider-Kamp Date: Thu, 10 Aug 2000 04:23:30 +0000 Subject: remove all occurence of math.rint() from the sources (and yes, "Currintly" also counts <0.5 wink>) --- Doc/lib/libmath.tex | 5 -- Include/mymath.h | 2 - Include/pyport.h | 2 - Lib/profile.py | 2 +- Lib/test/output/test_math | 1 - Lib/test/test_math.py | 12 --- Modules/mathmodule.c | 7 -- configure | 186 ++++++++++++++++++++++------------------------ configure.in | 6 -- 9 files changed, 90 insertions(+), 133 deletions(-) diff --git a/Doc/lib/libmath.tex b/Doc/lib/libmath.tex index d057e86..598431b 100644 --- a/Doc/lib/libmath.tex +++ b/Doc/lib/libmath.tex @@ -97,11 +97,6 @@ carry the sign of \var{x}. The integer part is returned as a real. Return \code{\var{x}**\var{y}}. \end{funcdesc} -\begin{funcdesc}{rint}{x, y} -Return the integer nearest to \var{x} as a real. -(Only available on platforms where this is in the standard C math library.) -\end{funcdesc} - \begin{funcdesc}{sin}{x} Return the sine of \var{x}. \end{funcdesc} diff --git a/Include/mymath.h b/Include/mymath.h index 27f301d..cead61a 100644 --- a/Include/mymath.h +++ b/Include/mymath.h @@ -55,7 +55,6 @@ extern double hypot(double, double); #undef log #undef log10 #undef pow -#undef rint #undef sin #undef sinh #undef sqrt @@ -75,7 +74,6 @@ extern double hypot(double, double); #define log logd #define log10 log10d #define pow powd -#define rint rintd #define sin sind #define sinh sinhd #define sqrt sqrtd diff --git a/Include/pyport.h b/Include/pyport.h index c682680..8cbc821 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -193,7 +193,6 @@ extern double hypot(double, double); #undef log #undef log10 #undef pow -#undef rint #undef sin #undef sinh #undef sqrt @@ -213,7 +212,6 @@ extern double hypot(double, double); #define log logd #define log10 log10d #define pow powd -#define rint rintd #define sin sind #define sinh sinhd #define sqrt sqrtd diff --git a/Lib/profile.py b/Lib/profile.py index e31363a..feaf287 100755 --- a/Lib/profile.py +++ b/Lib/profile.py @@ -390,7 +390,7 @@ class Profile: # more carefully the number of events (and cumulatively, the number # of events during sub functions) that are seen. If this were # done, then the arithmetic could be done after the fact (i.e., at - # display time). Currintly, we track only call/return events. + # display time). Currently, we track only call/return events. # These values can be deduced by examining the callees and callers # vectors for each functions. Hence we *can* almost correct the # internal time figure at print time (note that we currently don't diff --git a/Lib/test/output/test_math b/Lib/test/output/test_math index b0c48de..2a98000 100644 --- a/Lib/test/output/test_math +++ b/Lib/test/output/test_math @@ -19,7 +19,6 @@ log log10 modf pow -rint sin sinh sqrt diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 5c8efc6..6d6bc44 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -129,18 +129,6 @@ testit('pow(1,0)', math.pow(1,0), 1) testit('pow(2,1)', math.pow(2,1), 2) testit('pow(2,-1)', math.pow(2,-1), 0.5) -print 'rint' -try: - math.rint -except AttributeError: - # this platform does not have rint, that is fine, skip the test - pass -else: - testit('rint(0.7)', math.rint(0.7), 1) - testit('rint(-0.3)', math.rint(-0.3), 0) - testit('rint(2.5)', math.rint(2.5), 2) - testit('rint(3.5)', math.rint(3.5), 4) - print 'sin' testit('sin(0)', math.sin(0), 0) testit('sin(pi/2)', math.sin(math.pi/2), 1) diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index f51b63a..626e606 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -129,10 +129,6 @@ FUNC2(pow, power, FUNC2(pow, pow, "pow(x,y)\n\nReturn x**y.") #endif -#ifdef HAVE_RINT -FUNC1(rint, rint, - "rint(x)\n\nReturn the integer nearest to x as a real.") -#endif FUNC1(sin, sin, "sin(x)\n\nReturn the sine of x.") FUNC1(sinh, sinh, @@ -240,9 +236,6 @@ static PyMethodDef math_methods[] = { {"log10", math_log10, METH_VARARGS, math_log10_doc}, {"modf", math_modf, METH_VARARGS, math_modf_doc}, {"pow", math_pow, METH_VARARGS, math_pow_doc}, -#ifdef HAVE_RINT - {"rint", math_rint, METH_VARARGS, math_rint_doc}, -#endif {"sin", math_sin, METH_VARARGS, math_sin_doc}, {"sinh", math_sinh, METH_VARARGS, math_sinh_doc}, {"sqrt", math_sqrt, METH_VARARGS, math_sqrt_doc}, diff --git a/configure b/configure index 648a607..64167c5 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh -# From configure.in Revision: 1.140 +# From configure.in Revision: 1.142 # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 @@ -5084,14 +5084,66 @@ fi # checks for system services # (none yet) +# Cope with the DB mess. If we detect libdba, assume it's a version 2 +# or later DB and should be linked first (before the DB 1.xx stuff in glibc). +# Also define an appropriate symbol so we can conditionalize code in the +# dbmmodule; the API has changed since 1.xx. +echo $ac_n "checking for __db_mutex_lock in -ldba""... $ac_c" 1>&6 +echo "configure:5093: checking for __db_mutex_lock in -ldba" >&5 +ac_lib_var=`echo dba'_'__db_mutex_lock | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldba $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo dba | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + # Linux requires this for correct f.p. operations echo $ac_n "checking for __fpu_control""... $ac_c" 1>&6 -echo "configure:5090: checking for __fpu_control" >&5 +echo "configure:5142: checking for __fpu_control" >&5 if eval "test \"`echo '$''{'ac_cv_func___fpu_control'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func___fpu_control=yes" else @@ -5132,7 +5184,7 @@ if eval "test \"`echo '$ac_cv_func_'__fpu_control`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for __fpu_control in -lieee""... $ac_c" 1>&6 -echo "configure:5136: checking for __fpu_control in -lieee" >&5 +echo "configure:5188: checking for __fpu_control in -lieee" >&5 ac_lib_var=`echo ieee'_'__fpu_control | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5140,7 +5192,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lieee $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5184,7 +5236,7 @@ fi # Check for --with-fpectl echo $ac_n "checking for --with-fpectl""... $ac_c" 1>&6 -echo "configure:5188: checking for --with-fpectl" >&5 +echo "configure:5240: checking for --with-fpectl" >&5 # Check whether --with-fpectl or --without-fpectl was given. if test "${with_fpectl+set}" = set; then withval="$with_fpectl" @@ -5209,7 +5261,7 @@ BeOS) ;; *) LIBM=-lm esac echo $ac_n "checking for --with-libm=STRING""... $ac_c" 1>&6 -echo "configure:5213: checking for --with-libm=STRING" >&5 +echo "configure:5265: checking for --with-libm=STRING" >&5 # Check whether --with-libm or --without-libm was given. if test "${with_libm+set}" = set; then withval="$with_libm" @@ -5230,7 +5282,7 @@ fi # check for --with-libc=... echo $ac_n "checking for --with-libc=STRING""... $ac_c" 1>&6 -echo "configure:5234: checking for --with-libc=STRING" >&5 +echo "configure:5286: checking for --with-libc=STRING" >&5 # Check whether --with-libc or --without-libc was given. if test "${with_libc+set}" = set; then withval="$with_libc" @@ -5254,12 +5306,12 @@ LIBS="$LIBS $LIBM" for ac_func in hypot do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5258: checking for $ac_func" >&5 +echo "configure:5310: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5310,69 +5362,9 @@ done LIBS=$LIBS_SAVE -# check for rint() in math library -LIBS_SAVE=$LIBS -LIBS="$LIBS $LIBM" -for ac_func in rint -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5320: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:5348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - -LIBS=$LIBS_SAVE - # check for getopt echo $ac_n "checking for genuine getopt""... $ac_c" 1>&6 -echo "configure:5376: checking for genuine getopt" >&5 +echo "configure:5368: checking for genuine getopt" >&5 if eval "test \"`echo '$''{'ac_cv_func_getopt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5380,7 +5372,7 @@ else ac_cv_func_getopt=no else cat > conftest.$ac_ext < extern int optind, opterr, getopt(); @@ -5392,7 +5384,7 @@ int main() { exit(0); } EOF -if { (eval echo configure:5396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_getopt=yes else @@ -5410,7 +5402,7 @@ test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o" # check whether malloc(0) returns NULL or not echo $ac_n "checking what malloc(0) returns""... $ac_c" 1>&6 -echo "configure:5414: checking what malloc(0) returns" >&5 +echo "configure:5406: checking what malloc(0) returns" >&5 if eval "test \"`echo '$''{'ac_cv_malloc_zero'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5418,7 +5410,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < #ifdef HAVE_STDLIB @@ -5437,7 +5429,7 @@ main() { exit(0); } EOF -if { (eval echo configure:5441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull else @@ -5463,17 +5455,17 @@ fi # check for wchar.h ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for wchar.h""... $ac_c" 1>&6 -echo "configure:5467: checking for wchar.h" >&5 +echo "configure:5459: checking for wchar.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5477: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5469: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5503,12 +5495,12 @@ fi # check for usable wchar_t usable_wchar_t="unkown" echo $ac_n "checking for usable wchar_t""... $ac_c" 1>&6 -echo "configure:5507: checking for usable wchar_t" >&5 +echo "configure:5499: checking for usable wchar_t" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cat >> confdefs.h <<\EOF #define HAVE_USABLE_WCHAR_T 1 @@ -5541,14 +5533,14 @@ echo "$ac_t""$usable_wchar_t" 1>&6 # check for endianness echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:5545: checking whether byte ordering is bigendian" >&5 +echo "configure:5537: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -5559,11 +5551,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:5563: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -5574,7 +5566,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:5578: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -5594,7 +5586,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -5634,7 +5626,7 @@ fi # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). echo $ac_n "checking whether right shift extends the sign bit""... $ac_c" 1>&6 -echo "configure:5638: checking whether right shift extends the sign bit" >&5 +echo "configure:5630: checking whether right shift extends the sign bit" >&5 if eval "test \"`echo '$''{'ac_cv_rshift_extends_sign'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5643,7 +5635,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_rshift_extends_sign=yes else @@ -5684,12 +5676,12 @@ cat >> confdefs.h <<\EOF #endif EOF echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 -echo "configure:5688: checking for socklen_t" >&5 +echo "configure:5680: checking for socklen_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS diff --git a/configure.in b/configure.in index 1566643..56e58ed 100644 --- a/configure.in +++ b/configure.in @@ -1075,12 +1075,6 @@ LIBS="$LIBS $LIBM" AC_REPLACE_FUNCS(hypot) LIBS=$LIBS_SAVE -# check for rint() in math library -LIBS_SAVE=$LIBS -LIBS="$LIBS $LIBM" -AC_CHECK_FUNCS(rint) -LIBS=$LIBS_SAVE - # check for getopt AC_MSG_CHECKING(for genuine getopt) AC_CACHE_VAL(ac_cv_func_getopt, -- cgit v0.12