[ns] Bug in ns ? expr 100 + 0.1 returns 100.0999999999999 !!!!
Tue, 16 Jan 2001 18:30:12 +0000 (GMT)
On Tue, 16 Jan 2001, Heiler Matthias wrote:
> It's not a real bug. In tcl/lib/ns-default.tcl you can find the line
> set tcl_precision 17
> which basically switches off rounding.
...and makes Tcl about as accurate as it can be; see the Tcl FAQ:
Innocent question here. Given that ns has to bridge Tcl and C++,
wouldn't it be nice if the arithmetical accuracy was the same high
accuracy in both?
(Thinking of the satellite code, there's a lot of LEO orbit position
computation in C and spherical/cartesian conversion that might benefit
from Tcl's added precision, if not the resulting incredible
performance slowdown. Yup, more accurate C arithmetic would be nice.
Something to bear in mind when rewriting stuff in the other language