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

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



Hello,

Sorry if you received this message twice, but I cannot see it in the
archives.

I use ns-2.1b6 and I compiled without any modifications.  I noticed a
strange behavior using the procedure "expr".   I made the following test
using the NS compiled code and then I made the same using TCL version
8.    

Is this a bug  ?  Can someone tell me why expr outputs this result and
did the NS developpers ever met this ?  


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> 



Cheers,
Thierry