Skip to content
Tcl Source Code History Of Ticket 2931407
Login

History Of Ticket 2931407

Artifacts Associated With Ticket 2931407

  1. Ticket change [009b6203d4] (rid 119351) by cjmcdonald on 2010-01-13 15:25:14:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. 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.
      
    4. foundin initialized to: "obsolete: 8.5.8"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "cjmcdonald"
    10. subsystem initialized to: "45. Parsing and Eval"
    11. title initialized to: "expr.n should document integer division rounding"
    12. type initialized to: "Bug"
  2. Ticket change [bedca6ca26] (rid 102160) by dkf on 2010-01-14 00:30:37:

    1. 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.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  3. Ticket change [8f804f4d97] (rid 120281) by dkf on 2010-01-14 00:30:38:

    1. subsystem changed to: "47. Bytecode Compiler"
  4. Ticket change [0e010f8fa5] (rid 94532) by dkf on 2012-05-29 16:49:15:

    1. closedate changed to: "2012-05-29T09:49:15"
    2. closer changed to: "dkf"
    3. icomment:
      
      
      allow_comments - 1
      
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dkf"