Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3dc7c6a

Browse files
committed
Merged revisions 68296,68299 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r68296 | mark.dickinson | 2009-01-04 12:29:36 +0000 (Sun, 04 Jan 2009) | 6 lines Add autoconf test to detect x87-style double rounding, as described in issue #2937. This information can be helpful for diagnosing platform- specific problems in math and cmath. The result of the test also serves as a fairly reliable indicator of whether the x87 floating-point instructions (as opposed to SSE2) are in use on Intel x86/x86_64 systems. ........ r68299 | mark.dickinson | 2009-01-04 13:57:26 +0000 (Sun, 04 Jan 2009) | 4 lines isinf and isnan are macros, not functions; fix configure script to use AC_CHECK_DECLS instead of AC_CHECK_FUNCS for these. (See discussion in issue #4506) ........
1 parent 277a150 commit 3dc7c6a

5 files changed

Lines changed: 358 additions & 21 deletions

File tree

Include/pymath.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ extern double copysign(double, double);
8787
* Note: PC/pyconfig.h defines Py_IS_NAN as _isnan
8888
*/
8989
#ifndef Py_IS_NAN
90-
#ifdef HAVE_ISNAN
90+
#ifdef HAVE_DECL_ISNAN
9191
#define Py_IS_NAN(X) isnan(X)
9292
#else
9393
#define Py_IS_NAN(X) ((X) != (X))
@@ -104,7 +104,7 @@ extern double copysign(double, double);
104104
* Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf
105105
*/
106106
#ifndef Py_IS_INFINITY
107-
#ifdef HAVE_ISINF
107+
#ifdef HAVE_DECL_ISINF
108108
#define Py_IS_INFINITY(X) isinf(X)
109109
#else
110110
#define Py_IS_INFINITY(X) ((X) && (X)*0.5 == (X))

PC/pyconfig.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,11 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
395395
/* Define to 1 if you have the `copysign' function. */
396396
#define HAVE_COPYSIGN 1
397397

398-
/* Define to 1 if you have the `isinf' function. */
399-
#define HAVE_ISINF 1
398+
/* Define to 1 if you have the `isinf' macro. */
399+
#define HAVE_DECL_ISINF 1
400400

401401
/* Define to 1 if you have the `isnan' function. */
402-
#define HAVE_ISNAN 1
402+
#define HAVE_DECL_ISNAN 1
403403

404404
/* Define if on AIX 3.
405405
System headers sometimes define this.

configure

Lines changed: 293 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 67461 .
2+
# From configure.in Revision: 68245 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.61 for python 3.1.
55
#
@@ -21214,6 +21214,94 @@ fi
2121421214
LIBS_SAVE=$LIBS
2121521215
LIBS="$LIBS $LIBM"
2121621216

21217+
# Detect whether system arithmetic is subject to x87-style double
21218+
# rounding issues. The result of this test has little meaning on non
21219+
# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
21220+
# mode is round-to-nearest and double rounding issues are present, and
21221+
# 0 otherwise. See http://bugs.python.org/issue2937 for more info.
21222+
{ echo "$as_me:$LINENO: checking for x87-style double rounding" >&5
21223+
echo $ECHO_N "checking for x87-style double rounding... $ECHO_C" >&6; }
21224+
if test "${ac_cv_x87_double_rounding+set}" = set; then
21225+
echo $ECHO_N "(cached) $ECHO_C" >&6
21226+
else
21227+
21228+
if test "$cross_compiling" = yes; then
21229+
ac_cv_x87_double_rounding=no
21230+
else
21231+
cat >conftest.$ac_ext <<_ACEOF
21232+
/* confdefs.h. */
21233+
_ACEOF
21234+
cat confdefs.h >>conftest.$ac_ext
21235+
cat >>conftest.$ac_ext <<_ACEOF
21236+
/* end confdefs.h. */
21237+
21238+
#include <stdlib.h>
21239+
#include <math.h>
21240+
int main() {
21241+
volatile double x, y, z;
21242+
/* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
21243+
x = 0.99999999999999989; /* 1-2**-53 */
21244+
y = 1./x;
21245+
if (y != 1.)
21246+
exit(0);
21247+
/* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
21248+
x = 1e16;
21249+
y = 2.99999;
21250+
z = x + y;
21251+
if (z != 1e16+4.)
21252+
exit(0);
21253+
/* both tests show evidence of double rounding */
21254+
exit(1);
21255+
}
21256+
21257+
_ACEOF
21258+
rm -f conftest$ac_exeext
21259+
if { (ac_try="$ac_link"
21260+
case "(($ac_try" in
21261+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21262+
*) ac_try_echo=$ac_try;;
21263+
esac
21264+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21265+
(eval "$ac_link") 2>&5
21266+
ac_status=$?
21267+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
21268+
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
21269+
{ (case "(($ac_try" in
21270+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21271+
*) ac_try_echo=$ac_try;;
21272+
esac
21273+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21274+
(eval "$ac_try") 2>&5
21275+
ac_status=$?
21276+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
21277+
(exit $ac_status); }; }; then
21278+
ac_cv_x87_double_rounding=no
21279+
else
21280+
echo "$as_me: program exited with status $ac_status" >&5
21281+
echo "$as_me: failed program was:" >&5
21282+
sed 's/^/| /' conftest.$ac_ext >&5
21283+
21284+
( exit $ac_status )
21285+
ac_cv_x87_double_rounding=yes
21286+
fi
21287+
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
21288+
fi
21289+
21290+
21291+
fi
21292+
21293+
{ echo "$as_me:$LINENO: result: $ac_cv_x87_double_rounding" >&5
21294+
echo "${ECHO_T}$ac_cv_x87_double_rounding" >&6; }
21295+
if test "$ac_cv_x87_double_rounding" = yes
21296+
then
21297+
21298+
cat >>confdefs.h <<\_ACEOF
21299+
#define X87_DOUBLE_ROUNDING 1
21300+
_ACEOF
21301+
21302+
fi
21303+
21304+
2121721305
# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
2121821306
# -0. on some architectures.
2121921307
{ echo "$as_me:$LINENO: checking whether tanh preserves the sign of zero" >&5
@@ -21400,9 +21488,7 @@ done
2140021488

2140121489

2140221490

21403-
21404-
21405-
for ac_func in acosh asinh atanh copysign expm1 finite isinf isnan log1p
21491+
for ac_func in acosh asinh atanh copysign expm1 finite log1p
2140621492
do
2140721493
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
2140821494
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -21495,6 +21581,209 @@ _ACEOF
2149521581
fi
2149621582
done
2149721583

21584+
{ echo "$as_me:$LINENO: checking whether isinf is declared" >&5
21585+
echo $ECHO_N "checking whether isinf is declared... $ECHO_C" >&6; }
21586+
if test "${ac_cv_have_decl_isinf+set}" = set; then
21587+
echo $ECHO_N "(cached) $ECHO_C" >&6
21588+
else
21589+
cat >conftest.$ac_ext <<_ACEOF
21590+
/* confdefs.h. */
21591+
_ACEOF
21592+
cat confdefs.h >>conftest.$ac_ext
21593+
cat >>conftest.$ac_ext <<_ACEOF
21594+
/* end confdefs.h. */
21595+
#include <math.h>
21596+
21597+
int
21598+
main ()
21599+
{
21600+
#ifndef isinf
21601+
(void) isinf;
21602+
#endif
21603+
21604+
;
21605+
return 0;
21606+
}
21607+
_ACEOF
21608+
rm -f conftest.$ac_objext
21609+
if { (ac_try="$ac_compile"
21610+
case "(($ac_try" in
21611+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21612+
*) ac_try_echo=$ac_try;;
21613+
esac
21614+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21615+
(eval "$ac_compile") 2>conftest.er1
21616+
ac_status=$?
21617+
grep -v '^ *+' conftest.er1 >conftest.err
21618+
rm -f conftest.er1
21619+
cat conftest.err >&5
21620+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
21621+
(exit $ac_status); } && {
21622+
test -z "$ac_c_werror_flag" ||
21623+
test ! -s conftest.err
21624+
} && test -s conftest.$ac_objext; then
21625+
ac_cv_have_decl_isinf=yes
21626+
else
21627+
echo "$as_me: failed program was:" >&5
21628+
sed 's/^/| /' conftest.$ac_ext >&5
21629+
21630+
ac_cv_have_decl_isinf=no
21631+
fi
21632+
21633+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
21634+
fi
21635+
{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isinf" >&5
21636+
echo "${ECHO_T}$ac_cv_have_decl_isinf" >&6; }
21637+
if test $ac_cv_have_decl_isinf = yes; then
21638+
21639+
cat >>confdefs.h <<_ACEOF
21640+
#define HAVE_DECL_ISINF 1
21641+
_ACEOF
21642+
21643+
21644+
else
21645+
cat >>confdefs.h <<_ACEOF
21646+
#define HAVE_DECL_ISINF 0
21647+
_ACEOF
21648+
21649+
21650+
fi
21651+
{ echo "$as_me:$LINENO: checking whether isnan is declared" >&5
21652+
echo $ECHO_N "checking whether isnan is declared... $ECHO_C" >&6; }
21653+
if test "${ac_cv_have_decl_isnan+set}" = set; then
21654+
echo $ECHO_N "(cached) $ECHO_C" >&6
21655+
else
21656+
cat >conftest.$ac_ext <<_ACEOF
21657+
/* confdefs.h. */
21658+
_ACEOF
21659+
cat confdefs.h >>conftest.$ac_ext
21660+
cat >>conftest.$ac_ext <<_ACEOF
21661+
/* end confdefs.h. */
21662+
#include <math.h>
21663+
21664+
int
21665+
main ()
21666+
{
21667+
#ifndef isnan
21668+
(void) isnan;
21669+
#endif
21670+
21671+
;
21672+
return 0;
21673+
}
21674+
_ACEOF
21675+
rm -f conftest.$ac_objext
21676+
if { (ac_try="$ac_compile"
21677+
case "(($ac_try" in
21678+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21679+
*) ac_try_echo=$ac_try;;
21680+
esac
21681+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21682+
(eval "$ac_compile") 2>conftest.er1
21683+
ac_status=$?
21684+
grep -v '^ *+' conftest.er1 >conftest.err
21685+
rm -f conftest.er1
21686+
cat conftest.err >&5
21687+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
21688+
(exit $ac_status); } && {
21689+
test -z "$ac_c_werror_flag" ||
21690+
test ! -s conftest.err
21691+
} && test -s conftest.$ac_objext; then
21692+
ac_cv_have_decl_isnan=yes
21693+
else
21694+
echo "$as_me: failed program was:" >&5
21695+
sed 's/^/| /' conftest.$ac_ext >&5
21696+
21697+
ac_cv_have_decl_isnan=no
21698+
fi
21699+
21700+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
21701+
fi
21702+
{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isnan" >&5
21703+
echo "${ECHO_T}$ac_cv_have_decl_isnan" >&6; }
21704+
if test $ac_cv_have_decl_isnan = yes; then
21705+
21706+
cat >>confdefs.h <<_ACEOF
21707+
#define HAVE_DECL_ISNAN 1
21708+
_ACEOF
21709+
21710+
21711+
else
21712+
cat >>confdefs.h <<_ACEOF
21713+
#define HAVE_DECL_ISNAN 0
21714+
_ACEOF
21715+
21716+
21717+
fi
21718+
{ echo "$as_me:$LINENO: checking whether isfinite is declared" >&5
21719+
echo $ECHO_N "checking whether isfinite is declared... $ECHO_C" >&6; }
21720+
if test "${ac_cv_have_decl_isfinite+set}" = set; then
21721+
echo $ECHO_N "(cached) $ECHO_C" >&6
21722+
else
21723+
cat >conftest.$ac_ext <<_ACEOF
21724+
/* confdefs.h. */
21725+
_ACEOF
21726+
cat confdefs.h >>conftest.$ac_ext
21727+
cat >>conftest.$ac_ext <<_ACEOF
21728+
/* end confdefs.h. */
21729+
#include <math.h>
21730+
21731+
int
21732+
main ()
21733+
{
21734+
#ifndef isfinite
21735+
(void) isfinite;
21736+
#endif
21737+
21738+
;
21739+
return 0;
21740+
}
21741+
_ACEOF
21742+
rm -f conftest.$ac_objext
21743+
if { (ac_try="$ac_compile"
21744+
case "(($ac_try" in
21745+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21746+
*) ac_try_echo=$ac_try;;
21747+
esac
21748+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21749+
(eval "$ac_compile") 2>conftest.er1
21750+
ac_status=$?
21751+
grep -v '^ *+' conftest.er1 >conftest.err
21752+
rm -f conftest.er1
21753+
cat conftest.err >&5
21754+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
21755+
(exit $ac_status); } && {
21756+
test -z "$ac_c_werror_flag" ||
21757+
test ! -s conftest.err
21758+
} && test -s conftest.$ac_objext; then
21759+
ac_cv_have_decl_isfinite=yes
21760+
else
21761+
echo "$as_me: failed program was:" >&5
21762+
sed 's/^/| /' conftest.$ac_ext >&5
21763+
21764+
ac_cv_have_decl_isfinite=no
21765+
fi
21766+
21767+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
21768+
fi
21769+
{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isfinite" >&5
21770+
echo "${ECHO_T}$ac_cv_have_decl_isfinite" >&6; }
21771+
if test $ac_cv_have_decl_isfinite = yes; then
21772+
21773+
cat >>confdefs.h <<_ACEOF
21774+
#define HAVE_DECL_ISFINITE 1
21775+
_ACEOF
21776+
21777+
21778+
else
21779+
cat >>confdefs.h <<_ACEOF
21780+
#define HAVE_DECL_ISFINITE 0
21781+
_ACEOF
21782+
21783+
21784+
fi
21785+
21786+
2149821787

2149921788
LIBS=$LIBS_SAVE
2150021789

0 commit comments

Comments
 (0)