Skip to content
Tcl Source Code View Ticket
Login

View Ticket

bizarre interaction between wide int and double

Closed1006626fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 17 years ago
Descriptionplain2004-08-10 14:59:09
If a string that looks as if it might be a
wide integer overflows on input conversion,
the Tcl library stumbles when attempting
to convert it to a double:

% expr 0x7fffffffffffffff
9223372036854775807
% set x -9223372036854775809
-9223372036854775809
% expr double($x)
9.22337203685e+018
% scan $x %g
-9.22337203685e+018

This bug is related to 868489, but does
not appear to have as simple a fix.  
(By the way, how's 868489
coming? Reviewed the patch yet?)
dkfplain2004-09-11 05:57:57
Logged In: YES 
user_id=79902

Problem is (in HEAD) line 2466 of tclObj.c, which is in
SetWideIntFromAny, and it is that we do not check for
overflow (or is it underflow?) when negating the value. :(
dkfplain2004-09-19 00:19:06
Logged In: YES 
user_id=79902

Of course, the problem is what to actually do about it.  I
suspect the right thing might be to define a new ObjType
(overflowedNumberObjType?) which is understood by
Tcl_GetWideIntFromObj but which is not recognized as numeric
by TEBC and its cohorts...
dkf Ticket [1006626fff]: 1 change [History diff]2005-04-29 21:15:35
dgpplain2005-09-28 00:53:59
Logged In: YES 
user_id=80530


Bug is fixed on numerics branch
(TIP 237).
dgpplain2005-11-02 00:24:23
Logged In: YES 
user_id=80530

TIP 237 fixed this.
dkfplain2008-11-02 18:23:47
data_type - 210894
dkf Ticket [1006626fff]: 4 changes [History diff]2008-11-02 18:23:48
dkfplain2009-07-29 19:55:55
IP - Comment Removed: 130.88.1.31
Log in (anonymous is fine) to add a comment.