From: Gianluca Interlandi (gianluca_at_u.washington.edu)
Date: Thu Dec 08 2011 - 18:09:20 CST

Hi,

I have a question which concerns more TCL rather than VMD. I noticed
somthing strange (bug?) with TCL version 8.5 on 64 bit Linux
installations (openSUSE 11.1 and above).

For some reason multiplication of an integer with a decimal number gives a
weird result (both in the VMD Tk console and using tclsh in the console).
For example:

expr 3*0.1

returns:

0.30000000000000004

For example, if I run a loop, I get:

for {set i 1} {$i<=10} {incr i} {
set j [expr $i*0.1]
puts $j
}

0.1
0.2
0.30000000000000004
0.4
0.5
0.6000000000000001
0.7000000000000001
0.8
0.9
1.0

Has anybody else had the same problem? Is there a workaround?

Thanks,

      Gianluca

-----------------------------------------------------
Gianluca Interlandi, PhD gianluca_at_u.washington.edu
                     +1 (206) 685 4435
                     http://artemide.bioeng.washington.edu/

Postdoc at the Department of Bioengineering
at the University of Washington, Seattle WA U.S.A.
-----------------------------------------------------