Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Tcl_GetDouble fails with unknown floating point error

Closed / Fixed219046ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:09:52
OriginalBugID: 4118 Bug
Version: 8.2.3
SubmitDate: '2000-02-03'
LastModified: '2000-03-31'
Severity: CRIT
Status: Released
Submitter: techsupp
ChangedBy: ericm
OS: Linux-Red Hat
OSVersion: RedHat Linux 5.2 (Linux 2.2.11)
Machine: Digital HiNote VP (portable)
FixedDate: '2000-03-31'
FixedInVersion: 8.3.1
ClosedDate: '2000-10-25'


Name:

Eivind Tagseth


ObservedBehavior:

As far as I can see there is a small bug in tcl 8.2.3 in Tcl_GetDouble().

The function checks errno after calling strtod, but fails to check the

return value of strtod.  On my system strtod returns 1 as it should, but

errno is set to 84, causing Tcl_GetDouble to fail.


DesiredBehavior:

I expect Tcl_GetDouble to fail only if strtod's return value indicates that something went wrong.


Patch:

--- tcl8.2.3/generic/tclGet.c   Fri Apr 16 02:46:46 1999

+++ tcl8.2.3/generic/tclGet.new.c       Thu Feb  3 10:10:09 2000

@@ -220,7 +220,7 @@

         }

        return TCL_ERROR;

     }

-    if (errno != 0) {

+    if (errno != 0 && (d == HUGE_VAL || d == -HUGE_VAL || d == 0)) {

         if (interp != (Tcl_Interp *) NULL) {

             TclExprFloatError(interp, d); 

         }


PatchFiles:

generic/tclGet.c




Thanks for the patch.  I applied it to the sources in CVS, and the fix will go out with 8.3.1.

- eric

-- 03/31/2000 ericm
welch Closed ticket [219046ffff]. [History diff]2000-10-26 08:34:05
dgp Ticket [219046ffff]: 3 changes [History diff]2001-04-23 04:10:53
Log in (anonymous is fine) to add a comment.