Both formulas are the same and should give the same result. The difference you see in your example cases are due to the fact that all operations are integer. If you change it so as to do a float calculation, either formula will give the same result. Regards, Sita
> > Hi All, > Most people used below instruction for calculating a > bandwidth > #Calculate the bandwidth (in MBit/s) and write it to > the files > puts $grfd "$now [expr $bw1/$time*8/1024/1024] [expr > $bw2/$time*8/1024/1024] [expr $bw3/$time*8/1024/1024]" > > But I Think The Correct one is : > #Calculate the bandwidth (in MBit/s) and write it to > the files > puts $grfd "$now [expr $bw1*8/$time/1024/1024] [expr > $bw2/$time*8/1024/1024] [expr $bw3/$time*8/1024/1024]" > > I did this on ns > set x 5; > set y 2; > puts " [expr $x/$y*8/2/2]"; > output :4 > but > set x 5; > set y 2; > puts " [expr $x*8/$y/2/2]"; > output: 5 > > Whay is your ideas? > > Best Regards > Hamid Reza > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > >
