From 1b1fc7fb13ab288bc2f11cf549c8b0b05ecf7154 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 31 Mar 2008 17:21:13 +0000 Subject: merge updates from HEAD --- ChangeLog | 17 +++++++++++++ generic/tclInt.h | 14 +++++++---- generic/tclObj.c | 3 ++- tests/mathop.test | 6 ++--- unix/configure | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ unix/configure.in | 14 ++++++++++- unix/tclConfig.h.in | 3 +++ 7 files changed, 116 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9294744..e183ba5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2008-03-30 Kevin Kenny + + * generic/tclInt.h (TclIsNaN): + * unix/configure.in: Added code to the configurator to check for + a standard isnan() macro and use it if one + is found. This change avoids bugs where + the test of ((d) != (d)) is optimized away + by an overaggressive compiler. [Bug 1783544] + * generic/tclObj.c: Added missing #include needed to + locate isnan() after the above change. + + * unix/configure: autoconf-2.61 + + * tests/mathop.test (mathop-25.9, mathop-25.14): Modified tests + to deal with (slightly buggy) math libraries in which pow() + returns an incorrectly rounded result. [Bug 1808174] + 2008-03-26 Don Porter *** 8.5.2 TAGGED FOR RELEASE *** diff --git a/generic/tclInt.h b/generic/tclInt.h index 23c8adb..8a71b59 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.362 2008/01/23 21:32:36 dgp Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.362.2.1 2008/03/31 17:21:14 dgp Exp $ */ #ifndef _TCLINT @@ -3768,11 +3768,15 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, */ #ifdef _MSC_VER -#define TclIsInfinite(d) ( ! (_finite((d))) ) -#define TclIsNaN(d) (_isnan((d))) +# define TclIsInfinite(d) ( ! (_finite((d))) ) +# define TclIsNaN(d) (_isnan((d))) #else -#define TclIsInfinite(d) ( (d) > DBL_MAX || (d) < -DBL_MAX ) -#define TclIsNaN(d) ((d) != (d)) +# define TclIsInfinite(d) ( (d) > DBL_MAX || (d) < -DBL_MAX ) +# ifdef NO_ISNAN +# define TclIsNaN(d) ((d) != (d)) +# else +# define TclIsNaN(d) (isnan(d)) +# endif #endif /* diff --git a/generic/tclObj.c b/generic/tclObj.c index 0b2fddb..700b112 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -13,12 +13,13 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.139 2007/12/13 15:23:19 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.139.2.1 2008/03/31 17:21:15 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" #include +#include /* * Table of all object types. diff --git a/tests/mathop.test b/tests/mathop.test index c4dced5..b60b29d 100644 --- a/tests/mathop.test +++ b/tests/mathop.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: mathop.test,v 1.11 2007/12/13 15:26:06 dgp Exp $ +# RCS: @(#) $Id: mathop.test,v 1.11.2.1 2008/03/31 17:21:15 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -1202,12 +1202,12 @@ test mathop-25.5 { exp operator } {TestOp ** 1 5} 1 test mathop-25.6 { exp operator } {TestOp ** 5 1} 5 test mathop-25.7 { exp operator } {TestOp ** 4 3 2 1} 262144 test mathop-25.8 { exp operator } {TestOp ** 5.5 4} 915.0625 -test mathop-25.9 { exp operator } {TestOp ** 6 3.5} 529.0897844411664 +test mathop-25.9 { exp operator } {TestOp ** 16 3.5} 16384.0 test mathop-25.10 { exp operator } {TestOp ** 3.5 0} 1.0 test mathop-25.11 { exp operator } {TestOp ** 378 0} 1 test mathop-25.12 { exp operator } {TestOp ** 7.8 1} 7.8 test mathop-25.13 { exp operator } {TestOp ** 748 1} 748 -test mathop-25.14 { exp operator } {TestOp ** 6.3 -1} 0.15873015873015872 +test mathop-25.14 { exp operator } {TestOp ** 1.6 -1} 0.625 test mathop-25.15 { exp operator } {TestOp ** 683 -1} 0 test mathop-25.16 { exp operator } {TestOp ** 1 -1} 1 test mathop-25.17 { exp operator } {TestOp ** -1 -1} -1 diff --git a/unix/configure b/unix/configure index 099969b..697cf0d 100755 --- a/unix/configure +++ b/unix/configure @@ -16650,6 +16650,75 @@ done #-------------------------------------------------------------------- +# Check for support of isnan() function or macro +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking isnan" >&5 +echo $ECHO_N "checking isnan... $ECHO_C" >&6 +if test "${tcl_cv_isnan+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + +isnan(0.0); /* Generates an error if isnan is missing */ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_isnan=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_isnan=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_isnan" >&5 +echo "${ECHO_T}$tcl_cv_isnan" >&6 +if test $tcl_cv_isnan = no; then + +cat >>confdefs.h <<\_ACEOF +#define NO_ISNAN 1 +_ACEOF + +fi + +#-------------------------------------------------------------------- # Darwin specific API checks and defines #-------------------------------------------------------------------- diff --git a/unix/configure.in b/unix/configure.in index 82e68da..fb777b2 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tcl installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.180 2008/03/28 17:31:47 dgp Exp $ +# RCS: @(#) $Id: configure.in,v 1.180.2.1 2008/03/31 17:21:18 dgp Exp $ AC_INIT([tcl],[8.5]) AC_PREREQ(2.59) @@ -492,6 +492,18 @@ SC_ENABLE_LANGINFO AC_CHECK_FUNCS(chflags) #-------------------------------------------------------------------- +# Check for support of isnan() function or macro +#-------------------------------------------------------------------- + +AC_CACHE_CHECK([isnan], tcl_cv_isnan, [ + AC_TRY_LINK([#include ], [ +isnan(0.0); /* Generates an error if isnan is missing */ +], tcl_cv_isnan=yes, tcl_cv_isnan=no)]) +if test $tcl_cv_isnan = no; then + AC_DEFINE(NO_ISNAN, 1, [Do we have a usable 'isnan'?]) +fi + +#-------------------------------------------------------------------- # Darwin specific API checks and defines #-------------------------------------------------------------------- diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 986c721..179f68a 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -289,6 +289,9 @@ /* Do we have getwd() */ #undef NO_GETWD +/* Do we have a usable 'isnan'? */ +#undef NO_ISNAN + /* Do we have ? */ #undef NO_LIMITS_H -- cgit v0.12