<i>round() function with precision argument rounding away from zero</i> status still Open with 3 other changes
by
.
D 2026-01-12T04:27:04.787
J icomment Thanks\sfor\sthe\sclarification,\sand\s+1\sto\sdkf’s\spoint:\sif\sTcl\sever\sgrows\sfirst-class\ssupport\sfor\sselectable\srounding\smodes,\sa\scommand\s(or\ssmall\snamespace)\sis\sprobably\sthe\sright\sshape.\r\n\r\nFor\sthe\simmediate\sneed\sof\srounding\sto\sa\sgiven\snumber\sof\sdecimal\splaces,\s[format]\sis\soften\ssufficient\sfor\sproducing\sa\srounded\sdecimal\srepresentation,\se.g.:\r\n\r\nset\ss\s[format\s"%.2f"\s$x]\s\s\s\s\s\s\s\s\s\s\s;#\srounded\sstring\r\nset\sy\s[expr\s{double($s)}]\s\s\s\s\s\s\s\s\s\s;#\snumeric\svalue\sagain\s(if\sneeded)\r\n\r\nIf\sa\sspecific\stie-breaking\srule\sis\srequired\s(e.g.\s“ties\saway\sfrom\szero”),\sit\smay\sbe\sbetter\shandled\sby\sa\ssmall\shelper\sat\sthe\sscript\slevel,\sand\sa\sbroader\s“multiple\srounding\smodes”\sdesign\scan\sbe\sdiscussed\sseparately\sas\sits\sown\sRFE/TIP.\r\n\r\nGiven\sthe\sreporter’s\sfollow-up,\sthis\sticket\smay\sbe\sclosable\sas\s“documentation/workaround\sprovided”,\sleaving\sany\smore\sgeneral\srounding-mode\ssupport\sfor\sa\sdedicated\sproposal.
J login cdubois
J mimetype text/plain
K bd71dd33055d27d7fc8f075412359822195c3cd9
U cdubois
Z 3ae950239a1579c55125008ee5b92b7f