Skip to content

Commit

Permalink
merge 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
sebres committed Dec 28, 2024
2 parents 43387ca + 477921f commit 69ed0cf
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions generic/tclBasic.c
Original file line number Diff line number Diff line change
Expand Up @@ -8050,32 +8050,37 @@ ClassifyDouble(
#endif /* !fpclassify */
}

#define FP_CLS_ERROR -1
static inline int
DoubleObjClass(
Tcl_Interp *interp,
Tcl_Obj *objPtr) /* Object with double to get its class. */
Tcl_Obj *objPtr, /* Object with double to get its class. */
int *fpClsPtr) /* FP class retrieved for double in object. */
{
double d;
void *ptr;
int type;

if (Tcl_GetNumberFromObj(interp, objPtr, &ptr, &type) != TCL_OK) {
return FP_CLS_ERROR;
return TCL_ERROR;
}
switch (type) {
case TCL_NUMBER_NAN:
return FP_NAN;
*fpClsPtr = FP_NAN;
return TCL_OK;
case TCL_NUMBER_DOUBLE:
d = *((const double *) ptr);
break;
case TCL_NUMBER_INT:
d = (double)*((const Tcl_WideInt *) ptr);
break;
default:
if (Tcl_GetDoubleFromObj(interp, objPtr, &d) != TCL_OK) {
return FP_CLS_ERROR;
return TCL_ERROR;
}
break;
}
return ClassifyDouble(d);
*fpClsPtr = ClassifyDouble(d);
return TCL_OK;
}
static inline int
DoubleObjIsClass(
Expand All @@ -8092,8 +8097,7 @@ DoubleObjIsClass(
return TCL_ERROR;
}

dCls = DoubleObjClass(interp, objv[1]);
if (dCls == FP_CLS_ERROR) {
if (DoubleObjClass(interp, objv[1], &dCls) != TCL_OK) {
return TCL_ERROR;
}
dCls = (
Expand Down Expand Up @@ -8175,9 +8179,10 @@ ExprIsUnorderedFunc(
return TCL_ERROR;
}

dCls = DoubleObjClass(interp, objv[1]);
dCls2 = DoubleObjClass(interp, objv[2]);
if (dCls == FP_CLS_ERROR || dCls2 == FP_CLS_ERROR) {
if (
DoubleObjClass(interp, objv[1], &dCls) != TCL_OK ||
DoubleObjClass(interp, objv[2], &dCls2) != TCL_OK
) {
return TCL_ERROR;
}

Expand Down

0 comments on commit 69ed0cf

Please sign in to comment.