Skip to content
Tcl Source Code Artifact [1cb6bb5f6e]
Login

Artifact [1cb6bb5f6e]

Artifact 1cb6bb5f6e735afdf2c9dc4d04f56723c94405f0:

Ticket change [1cb6bb5f6e] - New ticket [866469ffffffffff|866469ffff] <i>Integers aren&#39;t strings anymore</i>. by lars_h on 2003-12-27 23:11:55.
D 2003-12-27T23:11:55
J assignee dkf
J cmimetype text/plain
J comment Throughout\smost\sof\sTcl8,\sthere\shas\sbeen\sa\sbug\s(or\s\nmalfeature\sof\sthe\stcl_precision\svariable)\sthat\stwo\sfloat\s\nvalues\scan\shave\sidentical\sstring\srepresentations\sbut\s\nstill\sbehave\sdifferently\swhen\soperated\son.\sI\shope\sthat\s\nTIP\s132\swill\ssoon\scorrect\sthis.\n\nAlthough\sfloats\shave\sbeen\sslightly\smagical,\sone\shas\s\nhowever\salways\sbeen\sable\sto\srely\son\sintegers\sto\snot\shide\s\nany\sinformation\sfrom\sthe\sstring\srepresentation.\sSadly,\s\nthat\sisn't\strue\sanymore.\sBehold:\n\n%\sset\sl\s[expr\s65536]\n65536\n%\sset\sw\s[expr\s{wide($l)}]\n65536\n%\sstring\sequal\s$l\s$w\n1\n%\sexpr\s{$l\s*\s65536}\n0\n%\sexpr\s{$w\s*\s65536}\n4294967296\n\nIn\sshort,\sthe\sbug\sis\sthat\s[expr]\slets\sits\sresult\sdepend\s\non\sdetails\sof\sthe\sinternal\srepresentation\sthat\sare\snot\s\nrecorded\sin\sthe\sstring\srepresentation.\n\n\nIn\sa\slarger\sperspective,\sI\sthink\sthis\sis\sa\ssymptom\sof\sa\s\nfailure\sto\sclearly\sdecide\swhat\san\sinteger\sshould\sbe\sin\s\nTcl,\sbut\ssortinh\sthat\sout\srequires\sa\sTIP.\s(IMHO\sthe\sonly\s\napproach\sthat\shas\sa\schance\sof\sbeing\sconsistent\sis\sto\s\nallow\sarbitrarily\slong\sdecimal\sstrings\sas\sintegers,\sas\s\nnow\suse\sefficient\sinternal\srepresentations\sfor\sintegers\s\nup\sto\s32\sor\s64\sbits,\sand\srely\son\ssome\scallback\ssimilar\s\nto\s[unknown]\sfor\sall\soperations\son\slarger\snumbers.)\n
J foundin obsolete:\s8.4.5
J priority 5\sMedium
J resolution None
J status Open
J submitter lars_h
J subsystem 16.\sCommands\sA-H
J title Integers\saren't\sstrings\sanymore
J type RFE
K 866469ffffffffffffffffffffffffffffffffff
U lars_h
Z 52ece8717090720177fbedfd794c2d3c