[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] Bug in ns ? expr 100 + 0.1 returns 100.0999999999999 !!!!



kunchanl wrote:
> 
> try
> 
> expr 100.0 + 0.1

Thanks - I did try that to encounter the problem, but I am still
surprised that "standard" TCL and "ns" TCL do not return the same value
and I think this is a bug.  If it's not, I would be glad to know the
reason.

Cheers,
Thierry


> > galibier:/home/glandon/ns/ns-all/ns-2.1b6> ./ns
> > % expr 100 + 1
> > 101
> > % expr 100 + 0.1
> > 100.09999999999999
> > % expr 0.1 + 100
> > 100.09999999999999
> > % exit
> > Mem:K User:1.02 Sys:0.09
> > galibier:/home/glandon/ns/ns-all/ns-2.1b6> tcl
> > tclsh    tclsh7.4 tclsh7.5 tclsh8.0
> > galibier:/home/glandon/ns/ns-all/ns-2.1b6> tclsh8.0
> > % expr 100 + 1
> > 101
> > % expr 100 + 0.1
> > 100.1
> > % expr 0.1 + 100
> > 100.1
> > % exit
> > galibier:/home/glandon/ns/ns-all/ns-2.1b6>