diff --git generic/tclScan.c generic/tclScan.c
index f6ff7a9f..98ae7bad 100644
--- generic/tclScan.c
+++ generic/tclScan.c
@@ -921,9 +921,10 @@ Tcl_ScanObjCmd(
 	    }
 	    if (flags & SCAN_LONGER) {
 		if (Tcl_GetWideIntFromObj(NULL, objPtr, &wideValue) != TCL_OK) {
-		    wideValue = ~(Tcl_WideUInt)0 >> 1;	/* WIDE_MAX */
 		    if (TclGetString(objPtr)[0] == '-') {
-			wideValue += 1U;	/* WIDE_MAX + 1 = WIDE_MIN */
+			wideValue = WIDE_MIN;
+		    } else {
+			wideValue = WIDE_MAX;
 		    }
 		}
 		if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) {
