.
D 2002-07-03T01:56:59
J closedate 2002-07-02T18:56:59
J closer msofer
J icomment Logged\sIn:\sYES\s\nuser_id=148712\n\nThis\sis\sbecause\sthe\sinternal\srepresentation\sof\s(1.2*3.0)\n*is*\slarger\sthan\sthe\sinternal\srepresentation\sof\s(3.6)\s-\nfloats\sare\sweird\s:(\n\nNow,\swhen\syou\sdo\s\n\s\s\sputs\s[expr\s3.6\s>\s$x]\s\nexpr\swill\sdo\sdouble\ssubstitution\s-\sessentially,\sit\sbuilds\nthe\sstring\n\s\s\s"3.6\s>\s$x"\nwith\s'$x'\sreplaced\sby\sthe\sstring\srepresentation\sof\sits\nvalue,\sthen\sparses\sthis\sstring\sand\sfinally\sevaluates\sthe\nexpression.The\sroundtrip\svia\sthe\sstring\srep\sof\s'$x'\scauses\nthe\sequality\sdue\sto\srounding\sin\sthe\sfloat-to-string\sconversion.\n\nIf\syou\sdo\sinstead\n\s\s\s\sputs\s[expr\s{3.6\s>\s$x}]\npreventing\sthe\sconversion\sto\sstring,\syou\sobtain\s1.\sSo:\sit\sis\nconsistent,\sthe\sproblem\sthat\sthey\saren't\sequal\sis\sintrinsic\nto\sthe\sbinary\srepresentation\sof\sfloats.\sThis\sis\sinherited\nfrom\sC.\n\nSee\shttp://wiki.tcl.tk/879\sfor\smore\stroublesome\sexamples\nwith\sreal\snumbers.\n
J login msofer
J mimetype text/plain
J resolution Invalid
J status Pending
J username msofer
K 576512ffffffffffffffffffffffffffffffffff
U msofer
Z e12072e7e1a25ea8c8dca996414e6782