mirror of
https://github.com/python/cpython
synced 2024-09-05 08:17:45 +00:00
Add configure-time test for log1p disrespecting zero sign.
This commit is contained in:
parent
22170edaf5
commit
7edecdd222
35
configure.in
35
configure.in
|
@ -3372,6 +3372,10 @@ fi
|
|||
LIBS_SAVE=$LIBS
|
||||
LIBS="$LIBS $LIBM"
|
||||
|
||||
AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
|
||||
AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
|
||||
AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
|
||||
|
||||
# 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)
|
||||
|
@ -3398,9 +3402,34 @@ then
|
|||
[Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
|
||||
AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
|
||||
AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
|
||||
if test "$ac_cv_func_log1p" = yes
|
||||
then
|
||||
# On some versions of AIX, log1p(-0.) returns 0. instead of
|
||||
# -0. See issue #9920.
|
||||
AC_MSG_CHECKING(whether log1p drops the sign of negative zero)
|
||||
AC_CACHE_VAL(ac_cv_log1p_drops_zero_sign, [
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
int main() {
|
||||
/* Fail if the signs of log1p(-0.) and -0. can be
|
||||
distinguished. */
|
||||
if (atan2(log1p(-0.), -1.) == atan2(-0., -1.))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
]])],
|
||||
[ac_cv_log1p_drops_zero_sign=no],
|
||||
[ac_cv_log1p_drops_zero_sign=yes],
|
||||
[ac_cv_log1p_drops_zero_sign=no])])
|
||||
AC_MSG_RESULT($ac_cv_log1p_drops_zero_sign)
|
||||
fi
|
||||
if test "$ac_cv_log1p_drops_zero_sign" = yes
|
||||
then
|
||||
AC_DEFINE(LOG1P_DROPS_ZERO_SIGN, 1,
|
||||
[Define if log1p(-0.) is 0. rather than -0.])
|
||||
fi
|
||||
|
||||
LIBS=$LIBS_SAVE
|
||||
|
||||
|
|
Loading…
Reference in a new issue