Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 11541bc307f1ba3113829a7d23e6aaa1dbe99cca
Ticket: 218000ffffffffffffffffffffffffffffffffff
'Inf' not understood in expr
User & Date: nobody on 2000-10-26 00:51:50
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed 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 changed to: "obsolete: 8.0p2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: ""Inf" not understood in expr"
  11. type changed to: "Bug"