From: William James Date: 2006-07-26T05:25:05+09:00 Subject: Re: Noob devision question jamiethehutt wrote: > I'm trying to make a percentage progress bar for an XMMS web interface, > I want to take the total track time and the elapsed time and then make > a length for the bar from the percentage completed. > > something like: > > totalbarsize = 180 > timeelapsed = 10 > totaltime = 30 > > percomplete = 0.0 > barlength = 0.0 > > percomplete = timeelapsed / totaltime > barlength = totalbarsize*percomplete > > puts barlength > > Now that should give me a barlength of 60 pixels but it gives 0 > instead. Anyone know what I'm doing wrong? > > Thanks! > > (I'll forget that I need barlength as an integer rather than a float > for now :-P) >> 10/30 => 0 >> 10*100/30 => 33