Skip to content
Tcl Source Code History Of Ticket 218000
Login

History Of Ticket 218000

Artifacts Associated With Ticket 218000

  1. Ticket change [11541bc307] (rid 95115) by nobody on 2000-10-26 00:51:50:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 680 Bug
      Version: 8.0p2
      SubmitDate: '1998-09-23'
      LastModified: '1999-09-15'
      Severity: LOW
      Status: Closed
      Submitter: welch
      ChangedBy: hobbs
      OS: All
      OSVersion: NA
      Machine: NA
      FixedDate: '2000-10-25'
      FixedInVersion: NA
      ClosedDate: '1999-09-15'
      
      
      I've got a program that returns the floating point number HUGE_VAL to
      Tcl.  Unfortunately, libc represents this as "Inf" which Tcl cannot convert
      back into a floating point number.
      
      Here's an example:
        - "$myobj" is an instance of a class I've created
        - "$myobj hugeVal" just returns the defined constant HUGE_VAL
        - "$myobj setIt" tries to convert the parameter via Tcl_GetDouble
      
      % $myobj hugeVal
      Inf
      % set val [$myobj hugeVal]
      Inf
      % set a [expr $val / 10]
      syntax error in expression "Inf / 10"
      % $myobj setIt $val
      expected floating-point number but got "Inf"
      
      
      The actual code for the "hugeVal" function looks like:
      
          case 32: {        // double hugeVal(void)
              double _retcode;
      
              if (_argc != 2) {
                  _interp->result = "wrong # args";
                  return TCL_ERROR;
              }
              _retcode = HUGE_VAL;
      
              sprintf(_interp->result,"%f",_retcode);
          } break;
      
      
                                                Brian
                                       ( [email protected] )
      
      
      The problem is that sprintf does the interp here, converting
      it to a regular string "Inf".  Code like this should benefit
      from Tcl_Obj's, where it needn't be stored as a string. 
      -- 09/15/1999 hobbs
      
    4. foundin initialized to: "obsolete: 8.0p2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to: ""Inf" not understood in expr"
    11. type initialized to: "Bug"
  2. Ticket change [9c4796593f] (rid 96122) by welch on 2000-10-26 08:12:11:

    1. closedate changed to: "2000-10-26T01:12:11"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [e96627949a] (rid 104815) by dgp on 2001-04-16 20:52:08:

    1. closedate changed to: "2001-04-16T13:52:08"
    2. closer changed to: "dgp"
    3. resolution changed to: "Invalid"
    4. subsystem changed to: "None"
    5. title changed to: ""Inf" not understood in expr"
  4. Ticket change [0c7857739f] (rid 114183) by nobody on 2001-08-10 19:51:32:

    1. icomment:
      Logged In: NO 
      
      I wanted to add some thing more to this.
      If test case like this.
      
      tcl> set a INF
      tcl>if{($a == "*")} {
      }
      
      It's giving floating-point value too large.
      Please comment on this.
      
      This is only on HPUX platform only.
      
      
    2. login: "nobody"
    3. mimetype: "text/plain"
    4. username: "nobody"
  5. Ticket change [d38b47524d] (rid 123307) by dgp on 2001-08-10 23:16:00:

    1. status changed to: "Open"
  6. Ticket change [ae9e7c8077] (rid 101671) by dgp on 2001-08-10 23:16:01:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      Re-opening this so we can address the
      new HPUX comment.  Need to examine
      cross-platform inconsistency of [expr]
      -- probably due to inconsistency of
      strtod() or something similar.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. subsystem changed to: "45. Parsing and Eval"
    5. title changed to: ""Inf" not understood in expr"
    6. username: "dgp"
  7. Ticket change [c79533bbb1] (rid 121954) by dgp on 2001-08-10 23:16:29:

    1. assignee changed to: "msofer"
    2. title changed to: ""Inf" not understood in expr"
  8. Ticket change [3456dff99f] (rid 106746) by msofer on 2001-08-14 21:04:37:

    1. assignee changed to: "hobbs"
    2. title changed to: ""Inf" not understood in expr"
  9. Ticket change [d44ed00c49] (rid 123419) by hobbs on 2002-02-26 05:16:36:

    1. assignee changed to: "dgp"
    2. icomment:
      Logged In: YES 
      user_id=72656
      
      SuSE 7.3 build of 2002-02-25 8.4 build also gives:
      
      % expr {"INF"}
      floating-point value too large to represent
      
      That actually seems correct to me in some sense.
      
      
    3. login: "hobbs"
    4. mimetype: "text/plain"
    5. title changed to: ""Inf" not understood in expr"
    6. username: "hobbs"
  10. Ticket change [236fb602da] (rid 130933) by dgp on 2002-02-26 07:08:56:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      This is weird though:
      
      % set a INF
      INF
      % expr {$a + 1}
      can't use floating-point value as operand of "+"
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. title changed to: ""Inf" not understood in expr"
    5. username: "dgp"
  11. Ticket change [8f29cc2ceb] (rid 120239) by dgp on 2002-07-06 03:47:38:

    1. assignee changed to: "dkf"
    2. icomment:
      Logged In: YES 
      user_id=80530
      
      Error message is improved now:
      
      % set a Inf
      Inf
      % expr {$a + 1}
      floating-point value too large to represent
      
      The original report has a better error message now too:
      
      % expr $a + 1
      syntax error in expression "Inf + 1": variable references
      require preceding $
      
      so there appears to be a consistency here.
      
      Open issues:
      1) Is this consitency cross-platform?
      2) Is documentation sufficient?
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. subsystem changed to: "16. Commands A-H"
    6. title changed to: ""Inf" not understood in expr"
    7. username: "dgp"
  12. Ticket change [735de7ab4f] (rid 105035) by dkf on 2002-07-06 05:35:22:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=79902
      
      Hmm.  The expression parser probably doesn't know about Inf
      (or NaN either.)
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. subsystem changed to: "45. Parsing and Eval"
    6. title changed to: ""Inf" not understood in expr"
    7. username: "dkf"
  13. Ticket change [4855984250] (rid 99865) by dgp on 2002-07-22 07:54:12:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      another data point on this:
      
      Tcl is not consistent in
      treating Inf and Nan:
      
      % expr {"nan"}
      domain error: argument not in valid range
      % expr {nan}
      domain error: argument not in valid range
      % expr {"inf"}
      floating-point value too large to represent
      % expr {inf}
      syntax error in expression "inf"
      
      The difference is due to line 1555 of
      tclParseExpr.c which specially looks for
      'n' or 'N' to give strtod() a chance to
      claim it.  
      
      It would be more consistent to either
      check for 'i' and 'I" there as well, or to
      check for none of them.
      
      Given the original report here, the better
      choice is probably to check for both
      so that all string reps of doubles generated
      by Tcl get recognized by Tcl as string reps
      of doubles with [expr] without quoting.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. title changed to: ""Inf" not understood in expr"
    5. username: "dgp"
  14. Ticket change [6968397eb5] (rid 103244) by dkf on 2002-07-22 16:15:39:

    1. assignee changed to: "dkf"
    2. icomment:
      Logged In: YES 
      user_id=79902
      
      % expr {inf + 1}
      syntax error in expression "inf + 1": variable references
      require preceding $
      % expr {nan + 1}
      domain error: argument not in valid range
      % set i inf; expr {$i + 1}
      can't use floating-point value as operand of "+"
      % set n nan; expr {$n + 1}
      domain error: argument not in valid range
      % info patch
      8.4b2
      % parray tcl_platform
      tcl_platform(byteOrder) = bigEndian
      tcl_platform(machine)   = sun4u
      tcl_platform(os)        = SunOS
      tcl_platform(osVersion) = 5.8
      tcl_platform(platform)  = unix
      tcl_platform(user)      = fellowsd
      tcl_platform(wordSize)  = 4
      
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. title changed to: "'Inf' not understood in expr"
    6. username: "dkf"
  15. Ticket change [a114b9a105] (rid 109659) by dkf on 2002-07-22 17:04:58:

    1. closedate changed to: "2002-07-22T10:04:58"
    2. closer changed to: "dkf"
    3. resolution changed to: "Fixed"
    4. status changed to: "Closed"