Skip to content
Tcl Source Code View Ticket
Login

View Ticket

denormals break EIAS

Closed / Fixed1108528fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2005-01-24 18:20:53
The following script:

   set tcl_precision 17
   # Generate a small value.
   set x [expr {exp(-707)}]
   # Push it into denormal territory.
   while {(0.5*$x)>0.0} { set x [expr {0.5*$x}] }
   puts "    x = $x (double)"
   # Get a text value divorced from the double
representation.
   set y [format "%.17g" $x]
   puts "    y = $y (string)"
   # Doh! Can't convert back to double...
   catch {expr {$y*1.0}} result
   puts "y*1.0 = $result"
   puts "x*1.0 = [expr {$x*1.0}]"

produces:

    x = 4.9406564584124654e-324 (double)
    y = 4.9406564584124654e-324 (string)
y*1.0 = can't use floating-point value as operand of "*"
x*1.0 = 4.9406564584124654e-324

Clearly this is another example of
"everything is a string" getting violated.

Secondary issue is that the error message
is terrible.
bericplain2005-01-25 19:54:40
Logged In: YES 
user_id=493507

Hello,

See also bug 532537:
<http://sourceforge.net/tracker/index.php?func=detail&aid=532537&group_id=10894&atid=110894>
kennykbplain2005-05-11 02:18:16
Logged In: YES 
user_id=99768

Fixed in 8.5 with the TIP #132 changes.
Log in (anonymous is fine) to add a comment.