From: <no...@so...> - 2002-02-25 22:16:39
|
Bugs item #218000, was opened at 2000-10-25 17:51 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=218000&group_id=10894 Category: 43. Parsing and Eval Group: = 8.0p2 Status: Open Resolution: Invalid Priority: 2 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Don Porter (dgp) >Summary: "Inf" not understood in expr Initial Comment: 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 ( bc...@ve... ) 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 ---------------------------------------------------------------------- >Comment By: Jeffrey Hobbs (hobbs) Date: 2002-02-25 14:16 Message: 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. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2001-08-10 09:16 Message: 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. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2001-08-10 05:51 Message: 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. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=218000&group_id=10894 |