Skip to content
Tcl Source Code View Ticket
Login

View Ticket

expr doesn't always "do the right thing" with signed vs. uns

Closed / Fixed218220ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:54:39
OriginalBugID: 2584 Bug
Version: 8.2
SubmitDate: '1999-08-20'
LastModified: '2000-04-03'
Severity: LOW
Status: Closed
Submitter: hobbs
ChangedBy: hobbs
OS: All
FixedDate: '2000-10-25'
ClosedDate: '2000-04-03'


In the following:

(tkcon) 49 % expr 2147483647
2147483647
(tkcon) 50 % expr 2147483648
-2147483648
(tkcon) 51 % expr 2147483649
-2147483647

We are getting "undesirable" results.  Should check and see
what a true 64 bit OS does.

This may be "undesirable", but it is expected on 32bit int systems.
64bit systems will just wrap at a much larger value.  It was discussed
at an earlier point whether Tcl should wrap or complain instead, and
it was decided that wrapping is "better" (after all, that's what C
does too). 
-- 04/03/2000 hobbs
welch Closed ticket [218220ffff]. [History diff]2000-10-26 08:16:58
dgp Open ticket [218220ffff]. [History diff]2001-04-19 00:42:11
dgp Closed ticket [218220ffff]. [History diff]2001-04-19 00:43:18
Log in (anonymous is fine) to add a comment.