Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 009b6203d41f8902b39e4d7c181425d19edf6140
Ticket: 2931407fffffffffffffffffffffffffffffffff
expr.n should document integer division rounding
User & Date: cjmcdonald on 2010-01-13 15:25:14
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed 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 changed to: "obsolete: 8.5.8"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "cjmcdonald"
  10. subsystem changed to: "45. Parsing and Eval"
  11. title changed to: "expr.n should document integer division rounding"
  12. type changed to: "Bug"