Skip to content
Tcl Source Code Artifact [4a5125a413]
Login

Artifact [4a5125a413]

Artifact 4a5125a413cb4ccaa3ba30845cb91037405c33cc:

Ticket change [4a5125a413] - Ticket [3105247fffffffff|3105247fff] <i>-NaN?</i> status still Open with 4 other changes by kennykb on 2010-12-22 23:13:41.
D 2010-12-22T23:13:41
J icomment There\sare\splatforms\s-\sI\sno\slonger\shave\smy\snotes\sabout\swhich,\sI\ssuspect\sHP\sPA-RISC\s-\swhere\seven\scopying\sa\ssignalling\sNaN\seither\sraises\sa\ssignal\s(if\sthe\sexception\sis\sunmasked)\sor\ssilently\sconverts\sit\sto\sa\squiet\sNaN\s(if\sthe\sexception\sis\smasked).\s\sEven\spassing\sthe\sNaN\sinto\sTcl_NewDoubleObj\sas\sa\sparameter\sis\senough\sto\strigger\sthe\sbehaviour.\sThe\spatch\sas\sattached\sdoes\snothing\sabout\sthat.\sIt\ssimply\scannot.\s\n\nWhat\swould\sreally\sbe\sneeded\sfor\ssNaN\sis\sa\sway\sto\shandle\sthis\sright\sat\sthe\spoint\sof\sorigin.\sThat\swould\sinvolve\seither\shaving\sTcl_NewDoubleObj\sand\sfriends\saccept\sa\sPOINTER\sto\sthe\sdouble\s(so\sit\snever\sneeds\sto\senter\sa\sregister)\sand\san\sinterpreter\spointer\s(for\serror\smessage\sreporting).\sThat\swould\sallow\ssNaN\sto\sbe\sreported\sas\san\serror\sbefore\sit\sever\senters\sa\sTcl_Obj.\s(Of\scourse,\sTcl_GetDoubleFromObj\swould\sreturn\san\serror\sfor\sqNaN,\sbut\sleave\sthe\sNaN\sin\splace,\sjust\sas\sit\sdoes\snow,)\sBut\s-\swhy\sbother?\s\n\nTcl's\sdefined\sbehavior\sshould\sbe\sthat\sall\sNaNs\sare\ssignalling\swhen\spresented\sto\s[expr]\sor\sto\sTcl_GetDoubleFromObj.\sThe\shardware-level\ssNaN\sis\snot\sa\svalue\sin\sTcl's\svalue\scalculus.\ssNaN\spresented\sto\sTcl_{New,Set}DoubleObj\sis\squieted\sif\sthe\shardware\ssettings\sare\ssuch\sthat\sit\scan\sarrive\sthere\swithout\sa\scrash\s-\srecalling\sthat\sin\sthe\sarithmetic\scontexts\sof\sTcl,\sit\swill\scontinue\sto\sraise\sa\sTcl-level\sexception.\s\n\nI\sdon't\ssee\sa\sconvincing\sreason\sfor\sattempting\sto\simplement\sfull-up\sIEEE\sexception\scontrol\sin\sTcl\sproper,\sparticularly\sin\slight\sof\sthe\sfact\sthat\sfew\sC\scompilers\scan\sdo\sanything\ssensible\swith\sFPE.\s\sAll\sthat\sI\swanted\swhen\sI\sdid\sthis\scode\soriginally\swas\sfor\sC\scode\sto\sbe\sable\sto\scall\sTcl_NewDoubleObj\swithout\sneeding\sto\sjump\sthrough\sisnan()\shoops\sto\savoid\scrashing\sthe\sprocess.\sI\sreally\sdon't\ssee\sany\suse\scase\sfor\sbit-for-bit\spreservation\sof\ssNaN,\sand\sI\sdo\sforesee\stremendous\smaintenance\sheadaches\sif\swe\sstart\sto\sallow\sit.\ssNaN\scrashes\sthe\sprocess\sas\ssoon\sas\sit\sleaks\sinto\sthe\sFPU,\sand\smaintenance\schanges\son\sTcl's\sfloating-point\spipeline\sare\slikely\sto\sintroduce\ssuch\sleaks\sfrom\stime\sto\stime.\n
J login kennykb
J mimetype text/plain
J username kennykb
K 3105247fffffffffffffffffffffffffffffffff
U kennykb
Z 741deb3fbc262ced49707ace715cde7a