Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Error results from assignment of hex value to scale variable

Closed / Wont Fix1353531fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 20 years ago
Descriptionplain2005-11-10 23:00:42
In MS Windows NT 5.1 using Tcl/Tk 8.4.11 an error
results when a hexadecimal value is assigned to a scale
variable. The error message is: "can't assign
non-numeric value to scale variable".
To reproduce:

     scale .s -variable foo
     set foo 0xff

If the second line is replaced by:

    set foo 255

no error results. I think that this is a bug in the MS
Windows code since it is not only correct on my
understanding of Tcl but works under Linux. Although I
have thus far encountered the bug only using Tk, it
appears to be a Tcl bug since whether a value is
treated as numeric or not is a Tcl issue.
hobbs Ticket [1353531fff]: 1 change [History diff]2005-11-15 03:08:47
hobbsplain2005-11-15 03:08:48
Logged In: YES 
user_id=72656

This is indeed actually a Tcl "bug", though only in 8.4, not
in 8.5 (which changed various numeric handling). 
ScaleVarProc is calling Tcl_GetDoubleFromObj on that var,
and it fails for 0xff.  I would think that should work,
being a valid strtod value, but it fails.  Passing to Kevin.
kennykbplain2006-09-02 00:26:49
Logged In: YES 
user_id=99768

What we're dealing with here is C89-C9x differences
in 'strtod' - prior to C9x, there was no standard
hexadecimal notation for floating point, and Microsoft's
'strtod' does not accept hex.

Tcl's Tcl_GetDoubleFromObj in 8.5 doesn't depend on
the C library 'strtod' - we have our own scanner that
also avoids a number of other issues in 'strtod' (for
instance, the fact that Microsoft's does not do
gradual underflow and is often off by several units
in the least significant place).  The changes for this
are tied up in the changes for arbitrary-precision
integers, and are not going to backport gracefully,
so I'm going to close this as "Won't Fix" in 8.4 and
fixed in 8.5.
sf-robotplain2006-09-16 09:20:11
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.