Artifacts Associated With Ticket 2931407
Ticket change [009b6203d4] (rid 119351) by cjmcdonald on 2010-01-13 15:25:14:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
The expr.n man pages refers to a C manual for a description of the behaviour of arithmetic operators. But, in Tcl [expr { -57/10 }] gives -6, rounding towards minus infinity. This was a surprise to me, as most C implementations round towards zero, and -57/10 returns -5. Googling, the latest C standard ISO 9899:1999 actually specifies rounding towards zero in this case. Previously it appears to have been "implementation dependant". So we are now at odds with standard C here. I think that the expr.n man page should document this behaviour. - foundin initialized to: "obsolete: 8.5.8"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "cjmcdonald"
- subsystem initialized to: "45. Parsing and Eval"
- title initialized to: "expr.n should document integer division rounding"
- type initialized to: "Bug"
Ticket change [bedca6ca26] (rid 102160) by dkf on 2010-01-14 00:30:37:
- icomment:
It has to do with the behaviour of %, where Tcl guarantees that the sign of the result will be the same as the sign of the right hand side (and smaller in magnitude). Add in the constraint that X - X%Y = (X/Y)*Y (which is a pretty sensible constraint!) and you get the behaviour that Tcl requires as a natural consequence.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [8f804f4d97] (rid 120281) by dkf on 2010-01-14 00:30:38:
- subsystem changed to: "47. Bytecode Compiler"
Ticket change [0e010f8fa5] (rid 94532) by dkf on 2012-05-29 16:49:15:
- closedate changed to: "2012-05-29T09:49:15"
- closer changed to: "dkf"
- icomment:
allow_comments - 1
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"