Skip to content
Tcl Source Code History Of Ticket 761471ffffffffff
Login

History Of Ticket 761471ffffffffff

Artifacts Associated With Ticket 761471ffffffffff

  1. Ticket change [900b3c865a] (rid 120373) by dgp on 2003-06-26 21:45:01:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      This is inconsistent:
      
      % set x NaN; expr {$x == NaN} 
      1
      % expr {$x == NaN} 
      0
      
      They are different because the
      first case follows an optimization
      in INST_EQ that a Tcl_Obj will
      be == to itself.
      
      The second case actually flows
      through to a C-level comparison
      of two NaN doubles, and at least
      on this platform, the result is false.
      
      
    4. foundin initialized to: "obsolete: 8.4.3"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "dgp"
    9. subsystem initialized to: "47. Bytecode Compiler"
    10. title initialized to: "INST_EQ issues with NaN"
    11. type initialized to: "Bug"
  2. Ticket change [d575680ea9] (rid 123627) by dkf on 2003-06-27 15:38:59:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Another case:
        % set x NaN; expr {$x == $x}
        1
      This case is *definitely* the INST_EQ opt.  The other case
      in the bug report mixes it up with aggressive literal
      sharing.  (Just a note that the C-level comparison result is
      correct; we don't want to put in special code to make NaN
      equal to itself!)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  3. Ticket change [5f301d34d7] (rid 115771) by msofer on 2004-03-27 05:25:10:

    1. assignee changed to: "dkf"
  4. Ticket change [245d750299] (rid 131097) by dkf on 2004-03-30 04:06:33:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Arguably, the solution is to only do the object comparison
      when not doing numeric comparison.  But figuring out which
      kind of comparison to do could be expensive.  Ick.  Looks
      like we'll need to deoptimise...  :-(
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  5. Ticket change [04ce38cf0a] (rid 88937) by msofer on 2004-03-30 04:39:24:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Is there any other exception to this? Ie, other possibility
      of a Tcl_Obj not being == to itself?
      If not, it coud be handled as a special case. What objtype
      is NaN? 
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  6. Ticket change [a7ec3e56ca] (rid 98883) by dkf on 2004-10-22 06:21:39:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      NaN is tclDoubleType (or non-numeric; could be a list just
      fine!)
      
      AFAICT, the only way to avoid the problem is to remove the
      equal-object check from the top of the INST_EQ implementation.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  7. Ticket change [ab4c0d7738] (rid 101079) by msofer on 2004-10-31 02:44:21:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      uhh - no, it can't be list type - it will have been
      converted to a double, as == attempts numeric conversion first.
      
      So the problem may well be that Tcl_GetDoubleFromObj is not
      handling NaN correctly? Is the following correct
       % expr double(NaN)
       domain error: argument not in valid range
      or should the return value be NaN?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  8. Ticket change [ec7a4f09f8] (rid 103713) by msofer on 2004-10-31 02:47:29:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      I did not get it, did I? Sorry ...
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  9. Ticket change [e6a24774f2] (rid 104327) by dkf on 2004-11-01 18:21:29:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      NaN is the only value that is not equal to itself, but it's
      non-trivial to write a special test for it. I believe we
      just have to deoptimize INST_EQ (though this will marginally
      shorten TEBC of course.)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  10. Ticket change [44ffeae36d] (rid 116806) by msofer on 2004-11-01 19:28:27:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Suggestion for change at INST_EQ and family:
      
      * Try first the conversion of valuePtr to numeric type (DEOPT)
      * Shortcut:
             if ((valuePtr == value2Ptr) && (t1Ptr !=
      &tclDoubleType)) {
                   ... shortcut; jump to end
             } else if (valuePtr != value2Ptr) {
                  ... convert value2Ptr
             }
             ... 
      
      This retains the shortcut for non-doubles, and forces
      doubles to go through the C library.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  11. Ticket change [6022274e06] (rid 115941) by dkf on 2004-11-01 21:42:44:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Your optimization won't work.  You simply can't rely on NaN
      being of tclDoubleType and the cost of determining the cases
      where the comparison is actually safe is rather too high. :^(
      
      At least in the equal object case, any through-string
      conversions will be mostly cached... :^/
      
      Fixed in HEAD; backport candidate or shall we not bother
      given how few people noticed this was broken for so many years?
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. resolution changed to: "Fixed"
    5. username: "dkf"
  12. Ticket change [84af562580] (rid 117600) by msofer on 2004-11-01 23:38:56:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Attaching a patch with my optimisation: it does seem to
      work. At least 
       % set x NaN; expr {$x == NaN}
       0
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  13. Add attachment "NaN.patch" [cd7a520253] (rid 95897) by msofer on 2004-11-01 23:38:58.

  14. Ticket change [6ca31426a9] (rid 128550) by msofer on 2004-11-01 23:38:58:

    1. icomment:
      
      
      File Added - 107246: NaN.patch
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  15. Ticket change [e1a70ed628] (rid 87491) by msofer on 2004-11-02 02:34:49:

    1. icomment:
      
      
      File Added - 107261: NaN.patch2
      
      Logged In: YES 
      user_id=148712
      
      Patch replaced with a better one. NaN stuff is OK (shortcut
      gives the same as glibc, howzzat for a criterion?). Don't
      know about other "funny" values like Inf, -0, ...
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  16. Add attachment "NaN.patch2" [680a5c21db] (rid 103000) by msofer on 2004-11-02 02:34:49.

  17. Ticket change [e41272a929] (rid 87899) by dkf on 2004-11-02 22:47:39:

    1. closedate changed to: "2004-11-02T15:47:39"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      Great.  That gives virtually the original functionality and
      yet gets the NaN nasty right. :^)
      
      Fixed in HEAD and 8.4 branch.
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "dkf"
  18. Ticket change [369d515b42] (rid 107136) by wildcard_25 on 2004-11-05 09:07:43:

    1. icomment:
      Logged In: YES 
      user_id=596509
      
      Tk: v8.5a2
      OS: WinXPsp2
      Head: 04-11-04
      Built with makefile.vc using VC7.1
      
      ==== expr-22.9 non-numeric floats: shared object equality 
      and NaN FAILED
      ==== Contents of test case:
      
          set x NaN
          expr {$x == $x}
      
      ---- Result was:
      1
      ---- Result should have been (exact matching):
      0
      ==== expr-22.9 FAILED
      
      
    2. login: "wildcard_25"
    3. mimetype: "text/plain"
    4. username: "wildcard_25"
  19. Ticket change [daf785b07d] (rid 107879) by dkf on 2004-11-05 16:10:51:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      This is a bug in VC's floating-point number handling.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  20. Ticket change [b7629711ac] (rid 125581) by msofer on 2004-11-05 16:32:27:

    1. assignee changed to: "kennykb"
    2. icomment:
      Logged In: YES 
      user_id=148712
      
      Note that thismeans that NaN handling in Tcl/VC has been
      broken for a while - our detection is done by the IS_NAN
      macro in tclExecute.c, which tests for exactly this.
      
      Just wild guessing here - maybe there is some compilation
      flag required to get proper IEEE handling, disabled by
      default 'cause it gets slower? 
      One possible solution would be to #define IS_NAN
      conditionally on the compiler being used. Maybe there is an
      equivalent function in VC that could be called? 
      
      Worst case - if the VC bug is unfixable, we should either
      disable the test on that platform, or maybe pay a heavy cost
      in double handling and try detecting NaN on the double's
      string rep?
      
      Assigning to Kevin as our resident VC guru ...
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. status changed to: "Open"
    6. username: "msofer"
  21. Ticket change [935cff34ee] (rid 105800) by kennykb on 2004-11-05 23:34:28:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=99768
      
      Ugh.  I just looked this one up.
      
      VC++6 is not IEEE-754 compliant with respect to NaN
      comparisons.  (I disassembled the object code - and
      verified this.  It simply doesn't check for "unordered"
      in the result word.  VC.NET allegedly fixes this - see
      for example
      
      http://msdn.microsoft.com/library/en-us/dndeepc/html/deep05282002.asp
      
      Where does that leave us?  We probably need to
      do explicit tests for the "special values" when
      compiling on VC++6.  There are tests available in
      <float.h>:
      
      _finite(x) - Returns TRUE for ordinary and subnormal
      values, FALSE for Inf and NaN
      
      _isnan(x) - Returns TRUE for NaN, FALSE for
      everything else.
      
      _fpclass(x) - Returns a value that classifies a given
      FP number.  See
      http://msdn.microsoft.com/library/en-us/vccore98/HTML/_crt__fpclass.asp
      for the constants.
      
      
    3. login: "kennykb"
    4. mimetype: "text/plain"
    5. resolution changed to: "None"
    6. username: "kennykb"
  22. Ticket change [8f564d28ce] (rid 120263) by msofer on 2004-11-05 23:39:01:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Can we then, for VC only,
        #define IS_NAN(x) _isnan(x)
      in tclExecute.c and have this stuff fixed?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  23. Add attachment "expr27.tcl" [2c00c6801f] (rid 118833) by kennykb on 2004-11-06 03:21:51.

  24. Ticket change [6d5e512b1a] (rid 128686) by kennykb on 2004-11-06 03:21:51:

    1. icomment:
      
      
      File Added - 107751: expr27.tcl
      
      Logged In: YES 
      user_id=99768
      
      For your consideration, I attach a proposed set of test vectors
      for verifying IEEE 754 comparison semantics.
      
      
    2. login: "kennykb"
    3. mimetype: "text/plain"
    4. username: "kennykb"
  25. Ticket change [ebe65634ef] (rid 103613) by msofer on 2004-11-12 03:26:53:

    1. assignee changed to: "kennykb"
    2. foundin changed to: "obsolete: 8.5a2"
  26. Ticket change [69d2444200] (rid 128046) by kennykb on 2004-11-12 06:02:43:

    1. icomment:
      Logged In: YES 
      user_id=99768
      
      Miguel suggests:
      #ifdef BORKEN_STIFF_COMPILER
      if (IS_NAN(d1) || IS_NAN(d2)) {
          if(*pc == INST_NEQ) {
              iResult = 1;
          } else {
              iResult = 0;
          }
          goto foundResult;
      }
      #endif
      near line 3383 in tclExecute.c
      
      
    2. login: "kennykb"
    3. mimetype: "text/plain"
    4. username: "kennykb"
  27. Ticket change [1873b0f5d2] (rid 122662) by msofer on 2004-11-13 04:40:19:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Note that  (at the top)
      
      #ifdef BORKEN_STIFF_COMPILER
      #define IS_NAN(x) _isnan(x)
      #else
      #define IS_NAN(x) ((x) != (x))
      #endif
      
      and the code below at line 3383 would fix the issue of msvc
      not doing the right comparisons for NaN, but does not touch
      the other brokenness in win: that strtod() does not
      recognize "NaN" as a double. 
      
      FWIW, that can be written simpler as
      
      #ifdef BORKEN_STIFF_COMPILER
          if (IS_NAN(d1) || IS_NAN(d2)) {
              iResult = (*pc == INST_NEQ);
              goto foundResult;
          }
      #endif
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  28. Ticket change [2ebfb12181] (rid 92942) by msofer on 2004-11-19 16:20:08:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      oh my - is bsd also borken_stiff? See Bug 1069261
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  29. Ticket change [3b889079a7] (rid 112762) by das on 2004-11-19 21:19:09:

    1. icomment:
      Logged In: YES 
      user_id=90580
      
      re 1069261:
      note that expr-22.9 suceeds on mac os x 10.3 and on OpenBSD 3.4 and 
      NetBSD 1.6.1.
      only macosx 10.2 and FreeBSD 4.8 are broken...
      
      
    2. login: "das"
    3. mimetype: "text/plain"
    4. username: "das"
  30. Ticket change [2669682950] (rid 88342) by sprkyflshpnts on 2004-11-24 01:47:12:

    1. icomment:
      Logged In: YES 
      user_id=854097
      
      expr-22.9 fails for me on WinXP SP2 using VC++ .NET 2003
      (Tcl 8.4.8).  It worked for me in Tcl 8.4.7.
      
      
    2. login: "sprkyflshpnts"
    3. mimetype: "text/plain"
    4. username: "sprkyflshpnts"
  31. Ticket change [ae814a0f79] (rid 101648) by dkf on 2004-11-24 17:13:10:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      expr-22.9 postdates 8.4.7
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  32. Ticket change [e98bc3b3c8] (rid 104834) by matzek on 2005-03-04 00:29:25:

    1. icomment:
      Logged In: YES 
      user_id=330806
      
      Another report:
      expr-22.9 is broken on HP-UX 64 bit
      -11.23 on IA64 using cc: HP aC++/ANSI C B3910B A.05.52 [Sep
      05 2003]
      -11.00 on PA-Risc using cc (HP C/ANSI C B3901BA B.11.02.02)
      
      kind regards
      -- Matthias Kraft
      
      
    2. login: "matzek"
    3. mimetype: "text/plain"
    4. username: "matzek"
  33. Ticket change [d5c56a6df3] (rid 123689) by kennykb on 2005-11-05 03:18:56:

    1. assignee changed to: "dgp"
    2. icomment:
      Logged In: YES 
      user_id=99768
      
      Don, should we close this as 'fixed in 8.5' and leave
      8.4 doing whatever it is that 8.4 does?
      
      
    3. login: "kennykb"
    4. mimetype: "text/plain"
    5. username: "kennykb"
  34. Ticket change [dc740e6e3d] (rid 114483) by dgp on 2005-11-05 03:28:48:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      if you mean that this will
      become "Won't Fix" on
      8.4, then I suggest silencing
      test expr-22.9 on that branch.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  35. Ticket change [4d50ac86ad] (rid 127033) by dgp on 2006-03-10 22:56:48:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=80530
      
      
      let's get off the fence 
      for 8.4.13.  Either fix
      this, or silence the test
      with a "knownBug" constraint.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. priority changed to: "9 Immediate"
    6. username: "dgp"
  36. Ticket change [906722ea5b] (rid 120447) by msofer on 2006-03-10 23:34:28:

    1. assignee changed to: "kennykb"
  37. Ticket change [bca91ba168] (rid 101791) by dgp on 2006-03-23 23:40:36:

    1. assignee changed to: "dgp"
    2. icomment:
      Logged In: YES 
      user_id=80530
      
      
      marked expr-22.9 nonPortable
      for 8.4.13 release.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. resolution changed to: "Wont Fix"
    6. status changed to: "Closed"
    7. username: "dgp"
  38. Ticket change [740e10973e] (rid 105135) by dgp on 2006-03-23 23:40:37:

    1. closedate changed to: "2006-03-23T16:40:37"
    2. closer changed to: "dgp"