summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclBasic.c6
-rw-r--r--generic/tclExecute.c12
-rw-r--r--generic/tclInt.h15
-rw-r--r--generic/tclLink.c6
-rw-r--r--generic/tclObj.c4
-rw-r--r--generic/tclStrToD.c2
-rw-r--r--generic/tclTest.c2
-rw-r--r--generic/tclUtil.c4
-rwxr-xr-xunix/configure41
-rw-r--r--unix/configure.ac12
-rw-r--r--unix/tclConfig.h.in3
11 files changed, 22 insertions, 85 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 714bd80..ae7a3dc 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -7841,7 +7841,7 @@ ExprSqrtFunc(
if (code != TCL_OK) {
return TCL_ERROR;
}
- if ((d >= 0.0) && TclIsInfinite(d)
+ if ((d >= 0.0) && isinf(d)
&& (Tcl_GetBignumFromObj(NULL, objv[1], &big) == TCL_OK)) {
mp_int root;
mp_err err;
@@ -7906,12 +7906,12 @@ CheckDoubleResult(
double dResult)
{
#ifndef ACCEPT_NAN
- if (TclIsNaN(dResult)) {
+ if (isnan(dResult)) {
TclExprFloatError(interp, dResult);
return TCL_ERROR;
}
#endif
- if ((errno == ERANGE) && ((dResult == 0.0) || TclIsInfinite(dResult))) {
+ if ((errno == ERANGE) && ((dResult == 0.0) || isinf(dResult))) {
/*
* When ERANGE signals under/overflow, just accept 0.0 or +/-Inf
*/
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 403f3c9..dfb195a 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -514,7 +514,7 @@ VarHashCreateVar(
*(ptrPtr) = (ClientData) \
(&((objPtr)->internalRep.wideValue)), TCL_OK) : \
TclHasInternalRep((objPtr), &tclDoubleType) \
- ? (((TclIsNaN((objPtr)->internalRep.doubleValue)) \
+ ? (((isnan((objPtr)->internalRep.doubleValue)) \
? (*(tPtr) = TCL_NUMBER_NAN) \
: (*(tPtr) = TCL_NUMBER_DOUBLE)), \
*(ptrPtr) = (ClientData) \
@@ -8653,7 +8653,7 @@ ExecuteExtendedBinaryMathOp(
* Check now for IEEE floating-point error.
*/
- if (TclIsNaN(dResult)) {
+ if (isnan(dResult)) {
TclExprFloatError(interp, dResult);
return GENERAL_ARITHMETIC_ERROR;
}
@@ -8966,7 +8966,7 @@ TclCompareTwoNumbers(
w1 = (Tcl_WideInt)d1;
goto wideCompare;
case TCL_NUMBER_BIG:
- if (TclIsInfinite(d1)) {
+ if (isinf(d1)) {
return (d1 > 0.0) ? MP_GT : MP_LT;
}
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
@@ -8999,7 +8999,7 @@ TclCompareTwoNumbers(
return compare;
case TCL_NUMBER_DOUBLE:
d2 = *((const double *)ptr2);
- if (TclIsInfinite(d2)) {
+ if (isinf(d2)) {
compare = (d2 > 0.0) ? MP_LT : MP_GT;
mp_clear(&big1);
return compare;
@@ -9602,11 +9602,11 @@ TclExprFloatError(
{
const char *s;
- if ((errno == EDOM) || TclIsNaN(value)) {
+ if ((errno == EDOM) || isnan(value)) {
s = "domain error: argument not in valid range";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", s, NULL);
- } else if ((errno == ERANGE) || TclIsInfinite(value)) {
+ } else if ((errno == ERANGE) || isinf(value)) {
if (value == 0.0) {
s = "floating-point value too small to represent";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
diff --git a/generic/tclInt.h b/generic/tclInt.h
index b82a473..75cd6e5 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4965,22 +4965,15 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit;
/*
*----------------------------------------------------------------
* Macros used by the Tcl core to test for some special double values.
- * The ANSI C "prototypes" for these macros are:
+ * (deprecated) The ANSI C "prototypes" for these macros are:
*
* MODULE_SCOPE int TclIsInfinite(double d);
* MODULE_SCOPE int TclIsNaN(double d);
*/
-#ifdef _MSC_VER
-# define TclIsInfinite(d) (!(_finite((d))))
-# define TclIsNaN(d) (_isnan((d)))
-#else
-# define TclIsInfinite(d) ((d) > DBL_MAX || (d) < -DBL_MAX)
-# ifdef NO_ISNAN
-# define TclIsNaN(d) ((d) != (d))
-# else
-# define TclIsNaN(d) (isnan(d))
-# endif
+#if !defined(TCL_NO_DEPRECATED) && !defined(BUILD_tcl)
+# define TclIsInfinite(d) isinf(d)
+# define TclIsNaN(d) isnan(d)
#endif
/*
diff --git a/generic/tclLink.c b/generic/tclLink.c
index 5baa092..39f5345 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -606,7 +606,7 @@ EqualDouble(
{
return (a == b)
#ifdef ACCEPT_NAN
- || (TclIsNaN(a) && TclIsNaN(b))
+ || (isnan(a) && isnan(b))
#endif /* ACCEPT_NAN */
;
}
@@ -615,9 +615,9 @@ static inline int
IsSpecial(
double a)
{
- return TclIsInfinite(a)
+ return isinf(a)
#ifdef ACCEPT_NAN
- || TclIsNaN(a)
+ || isnan(a)
#endif /* ACCEPT_NAN */
;
}
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 4ac9936..a06b8fd 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -2547,7 +2547,7 @@ Tcl_GetDoubleFromObj(
{
do {
if (objPtr->typePtr == &tclDoubleType) {
- if (TclIsNaN(objPtr->internalRep.doubleValue)) {
+ if (isnan(objPtr->internalRep.doubleValue)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"floating point value is Not a Number", -1));
@@ -3880,7 +3880,7 @@ TclGetNumberFromObj(
{
do {
if (objPtr->typePtr == &tclDoubleType) {
- if (TclIsNaN(objPtr->internalRep.doubleValue)) {
+ if (isnan(objPtr->internalRep.doubleValue)) {
*typePtr = TCL_NUMBER_NAN;
} else {
*typePtr = TCL_NUMBER_DOUBLE;
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 5ee5945..a7986b0 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -4832,7 +4832,7 @@ Tcl_InitBignumFromDouble(
* Infinite values can't convert to bignum.
*/
- if (TclIsInfinite(d)) {
+ if (isinf(d)) {
if (interp != NULL) {
const char *s = "integer value too large to represent";
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 0db8587..009c95f 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -1652,7 +1652,7 @@ TestdoubledigitsObjCmd(
if (status != TCL_OK) {
doubleType = Tcl_GetObjType("double");
if (Tcl_FetchInternalRep(objv[1], doubleType)
- && TclIsNaN(objv[1]->internalRep.doubleValue)) {
+ && isnan(objv[1]->internalRep.doubleValue)) {
status = TCL_OK;
memcpy(&d, &(objv[1]->internalRep.doubleValue), sizeof(double));
}
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index a96c752..66d1009 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3231,7 +3231,7 @@ Tcl_PrintDouble(
* Handle NaN.
*/
- if (TclIsNaN(value)) {
+ if (isnan(value)) {
TclFormatNaN(value, dst);
return;
}
@@ -3240,7 +3240,7 @@ Tcl_PrintDouble(
* Handle infinities.
*/
- if (TclIsInfinite(value)) {
+ if (isinf(value)) {
/*
* Remember to copy the terminating NUL too.
*/
diff --git a/unix/configure b/unix/configure
index 452d5da..5d18196 100755
--- a/unix/configure
+++ b/unix/configure
@@ -10341,47 +10341,6 @@ fi
#--------------------------------------------------------------------
-# Check for support of isnan() function or macro
-#--------------------------------------------------------------------
-
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking isnan" >&5
-printf %s "checking isnan... " >&6; }
-if test ${tcl_cv_isnan+y}
-then :
- printf %s "(cached) " >&6
-else $as_nop
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <math.h>
-int
-main (void)
-{
-
-isnan(0.0); /* Generates an error if isnan is missing */
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
- tcl_cv_isnan=yes
-else $as_nop
- tcl_cv_isnan=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_isnan" >&5
-printf "%s\n" "$tcl_cv_isnan" >&6; }
-if test $tcl_cv_isnan = no; then
-
-printf "%s\n" "#define NO_ISNAN 1" >>confdefs.h
-
-fi
-
-#--------------------------------------------------------------------
# Darwin specific API checks and defines
#--------------------------------------------------------------------
diff --git a/unix/configure.ac b/unix/configure.ac
index 335c5a2..7acb5ce 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -562,18 +562,6 @@ SC_ENABLE_LANGINFO
AC_CHECK_FUNCS(cfmakeraw chflags mkstemps)
#--------------------------------------------------------------------
-# Check for support of isnan() function or macro
-#--------------------------------------------------------------------
-
-AC_CACHE_CHECK([isnan], tcl_cv_isnan, [
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
-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 5c24d40..1acc55d 100644
--- a/unix/tclConfig.h.in
+++ b/unix/tclConfig.h.in
@@ -349,9 +349,6 @@
/* Do we have getwd() */
#undef NO_GETWD
-/* Do we have a usable 'isnan'? */
-#undef NO_ISNAN
-
/* Do we have memmove()? */
#undef NO_MEMMOVE