Skip to content
Tcl Source Code History Of Ticket 1893815
Login

History Of Ticket 1893815

Artifacts Associated With Ticket 1893815

  1. Ticket change [4cf5485945] (rid 126983) by zbigniew_b on 2008-02-14 15:48:35:

    1. assignee initialized to: "dgp"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      A "live example":
      
      tclsh8.5 [~/tmp]set a -0
      -0
      tclsh8.5 [~/tmp]puts  [::tcl::mathfunc::int $a]
      0
      tclsh8.5 [~/tmp]puts  [::tcl::mathfunc::abs $a]
      -0
      
      
      ...above explains the problem. But, as the others mentioned already:
      
      % expr {abs(-0)}
      0
      
      ...works fine.
      
    4. foundin initialized to: "obsolete: 8.5.1"
    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: "zbigniew_b"
    10. subsystem initialized to: "48. Number Handling"
    11. title initialized to: "A bug in ::tcl::mathfunc::abs"
    12. type initialized to: "Bug"
  2. Ticket change [322f0f898e] (rid 93567) by dgp on 2008-02-14 22:51:53:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      % foreach c [info commands tcl::mathfunc::*] {
      catch {$c 0} a
      catch {$c -0} b
      if {$a ne $b} {puts $c}
      }
      ::tcl::mathfunc::round
      ::tcl::mathfunc::abs
      ::tcl::mathfunc::entier
      ::tcl::mathfunc::min
      ::tcl::mathfunc::max
      
      These are the five mathfunc commands
      that return surprising, if not simply
      wrong, answers when passed -0.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  3. Ticket change [1cbd5061a7] (rid 90667) by dgp on 2008-02-14 22:59:49:

    1. title changed to: "tcl::mathfunc commands and -0"
  4. Ticket change [07e841f2d4] (rid 89487) by dgp on 2008-02-14 23:28:39:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      The general issue is whether mathfunc
      commands can, unlike [expr], return
      non-canonical string reps:
      
      % tcl::mathfunc::abs 0x0
      0x0
      % expr abs(0x0)
      0
      % tcl::mathfunc::abs 1.2345678901234567890123456789
      1.2345678901234567890123456789
      % expr abs(1.2345678901234567890123456789)
      1.2345678901234567
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. title changed to:
      tcl::mathfunc commands and non-canonical string reps
      
    5. username: "dgp"
  5. Ticket change [937df79841] (rid 105827) by dgp on 2008-02-14 23:38:32:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      Since tcl::mathfunc commands are 
      general Tcl commands, and programmers
      are invited to create their own, there's
      no systemic way to address this.
      
      We can certainly follow a practice
      with our own built-in commands that
      they return canonical strings only, if
      we wish.  Is it useful to do so?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [a7453df367] (rid 98763) by dgp on 2008-02-15 01:30:10:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      dgpI think the max and min implementations we have are good.  Actually returning one of the arguments seems like a positive thing.
      dgpThe docs for them might be enhanced a bit.
      dgpnot "greatest value", but "first argument not less than any other argument"
      
      % namespace path tcl::mathfunc
      % max 0x1 1
      0x1
      % max 1 0x1
      1
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [0c237dc042] (rid 114123) by dgp on 2008-03-10 23:03:28:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      The [abs] results are the greatest concern.
      They can leak into [expr] results as well:
      
      % expr {abs(-1e-323)}
      1e-323
      % expr {abs(-1e-324)}
      -0.0
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [2bf118f00f] (rid 118826) by dgp on 2008-03-10 23:18:51:

    1. closedate changed to: "2008-03-10T16:18:51"
    2. closer changed to: "dgp"
    3. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      Committed fix for abs().
      For now, I consider other issues
      raised here to be "not a bug".
      
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dgp"
  9. Ticket change [bac620c3d2] (rid 129375) by nobody on 2008-03-15 17:26:04:

    1. icomment:
      Logged In: NO 
      
      Where is the patch?
      
      
    2. login: "[email protected]"
    3. mimetype: "text/plain"
    4. username: "[email protected]"