rahulvramteke
Programmer
Hi I am using tcl 8.5.
When I do division 1.0/1e-9 i get 999999999.9999999 instead of 1e9.
The same operation on tcl 8.4 works fine.
How to get around this problem to get the correct value/
for {set x 0} {$x<20} {incr x} { puts "$x [expr 1/1e-$x]"}
-----------
OUTPUT
-----------
0 1.0
1 10.0
2 100.0
3 1000.0
4 10000.0
5 99999.99999999999
6 1000000.0
7 10000000.0
8 100000000.0
9 999999999.9999999
10 10000000000.0
11 100000000000.0
12 1000000000000.0
13 10000000000000.0
14 100000000000000.0
15 999999999999999.9
16 10000000000000000.0
17 1e+17
18 9.999999999999999e+17
19 1e+19
When I do division 1.0/1e-9 i get 999999999.9999999 instead of 1e9.
The same operation on tcl 8.4 works fine.
How to get around this problem to get the correct value/
for {set x 0} {$x<20} {incr x} { puts "$x [expr 1/1e-$x]"}
-----------
OUTPUT
-----------
0 1.0
1 10.0
2 100.0
3 1000.0
4 10000.0
5 99999.99999999999
6 1000000.0
7 10000000.0
8 100000000.0
9 999999999.9999999
10 10000000000.0
11 100000000000.0
12 1000000000000.0
13 10000000000000.0
14 100000000000000.0
15 999999999999999.9
16 10000000000000000.0
17 1e+17
18 9.999999999999999e+17
19 1e+19