Skip to content
Tcl Source Code History Of Ticket 2859027fff
Login

History Of Ticket 2859027fff

Artifacts Associated With Ticket 2859027fff

  1. Ticket change [3f5aaec90f] (rid 121441) by pixelz on 2009-09-15 02:15:22:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The bytecode compiler breaks on the following snippet:
      
      proc DoPrecision {} { puts "A $::tcl_precision [expr { 1.1 + 2.2 }]"
      if {[catch { incr ::tcl_precision }]} { return }
      puts "B $::tcl_precision [expr { 1.1 + 2.2 }]"
      DoPrecision
      }
      DoPrecision
      
      Example result:
      A 0 3.3000000000000003
      B 1 3.0
      A 1 3.3000000000000003
      B 2 3.0
      A 2 3.3000000000000003
      B 3 3.0
      A 3 3.3000000000000003
      B 4 3.0
      A 4 3.3000000000000003
      B 5 3.0
      A 5 3.3000000000000003
      B 6 3.0
      A 6 3.3000000000000003
      B 7 3.0
      A 7 3.3000000000000003
      B 8 3.0
      A 8 3.3000000000000003
      B 9 3.0
      A 9 3.3000000000000003
      B 10 3.0
      A 10 3.3000000000000003
      B 11 3.0
      A 11 3.3000000000000003
      B 12 3.0
      A 12 3.3000000000000003
      B 13 3.0
      A 13 3.3000000000000003
      B 14 3.0
      A 14 3.3000000000000003
      B 15 3.0
      A 15 3.3000000000000003
      B 16 3.0
      A 16 3.3000000000000003
      B 17 3.0
      A 17 3.3000000000000003
      
      
    4. foundin initialized to: "obsolete: 8.5.7"
    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: "pixelz"
    10. subsystem initialized to: "47. Bytecode Compiler"
    11. title initialized to: "Bytecode Compiler& tcl_precision"
    12. type initialized to: "Bug"
  2. Ticket change [445a698b21] (rid 116695) by pixelz on 2009-09-15 09:16:58:

    1. title changed to: "Bytecode Compiler & tcl_precision"
  3. Ticket change [1766e4ae66] (rid 122486) by dgp on 2009-09-16 00:34:49:

    1. assignee changed to: "dgp"
    2. icomment:
      
      Starting in Tcl 8.5, the expression parser
      detects constant expressions such as
      " 1.1 + 2.2 " and notices that their value
      is completely known at compile time, and
      creates bytecode that simply pushes  that
      value on the stack.  There is no runtime
      computation at all.
      
      This makes perfect sense using the 8.5
      defaults where EIAS for double values
      actually works.
      
      For legacy support of scripts continuing
      to use the ::tcl_precision variable against
      advice, the assumption that a constant
      expression will always compute the same
      result fails.
      
      Perhaps this can be fixed with some additional
      detections of changes to the ::tcl_precision
      variable triggering a reset of some compile epoch
      to force recompile of the expressions?
      
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. username: "dgp"
  4. Ticket change [8399c2dd08] (rid 117412) by dgp on 2009-09-16 00:38:02:

    1. icomment:
      
      A workaround would be to store the
      constant values "1.1" and "2.2" in
      variables so that compiling the expression
      does not introduce the optimization.
      
      set x 1.1; set y 2.2;
      expr {$x + $y}
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  5. Ticket change [af7d81617a] (rid 97823) by dgp on 2009-09-16 02:26:21:

    1. icomment:
      
      It appears this could be accommodated with
      changes to Tcl_PrintDouble() and TclPrecTraceProc(),
      but it is not clear at what expense.  Keeping this
      open at a low priority.  Recommend either the
      workaround already noted, or some other means
      to attack whatever real problem is trying to be
      addressed with the ::tcl_precision games.
      
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. priority changed to: "2"
    5. username: "dgp"
  6. Ticket change [ce029376dc] (rid 95983) by pixelz on 2009-09-16 02:32:59:

    1. icomment:
      tcl_precision doesn't have to be touched for this unexpected result to happen, simply:
      
      % expr 1.1+2.2
      3.3000000000000003
      
      in a fresh tclsh
      
      
    2. login: "pixelz"
    3. mimetype: "text/plain"
    4. username: "pixelz"
  7. Ticket change [7091e875ce] (rid 100507) by hobbs on 2009-09-16 02:35:25:

    1. icomment:
      And that result is technically correct in IEEE math, which is what Tcl is exposing.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"