Overview
| Artifact ID: | 11541bc307f1ba3113829a7d23e6aaa1dbe99cca |
|---|---|
| Ticket: | 218000ffffffffffffffffffffffffffffffffff
'Inf' not understood in expr |
| User & Date: | nobody on 2000-10-26 00:51:50 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- 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 - foundin changed to: "obsolete: 8.0p2"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "69. Other"
- title changed to: ""Inf" not understood in expr"
- type changed to: "Bug"