[freenet-dev] [freenet-cvs] r16639 - trunk/freenet/src/freenet/support/math

Florent Daignière nextgens at freenetproject.org
Tue Dec 18 15:27:39 UTC 2007


* Matthew Toseland <toad at amphibian.dyndns.org> [2007-12-18 15:21:28]:

> On Monday 17 December 2007 00:39, nextgens at freenetproject.org wrote:
> > Author: nextgens
> > Date: 2007-12-17 00:39:23 +0000 (Mon, 17 Dec 2007)
> > New Revision: 16639
> > 
> > Modified:
> >    trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
> > Log:
> > TimeDecayingRunningAverage: we were loosing in precision here (float => int)
> 
> No we're not, it's a long!

The commit message is wrong indeed, we were dividing a long by an int
and casting it to a double.

> > 
> > Modified: 
> trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
> > ===================================================================
> > --- trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java	
> 2007-12-17 00:24:38 UTC (rev 16638)
> > +++ trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java	
> 2007-12-17 00:39:23 UTC (rev 16639)
> > @@ -184,7 +184,8 @@
> >  						timeSkewCallback.setTimeSkewDetectedUserAlert();
> >  					return;
> >  				} else {
> > -					if((uptime / 4) < thisHalfLife) thisHalfLife = (uptime / 4);
> > +					double oneFourthOfUptime = uptime / 4D;
> > +					if(oneFourthOfUptime < thisHalfLife) thisHalfLife = oneFourthOfUptime;
> >  				}
> >  				
> >  				if(thisHalfLife == 0) thisHalfLife = 1;
> > 
> > _______________________________________________
> > cvs mailing list
> > cvs at freenetproject.org
> > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> > 
> > 



> _______________________________________________
> Devl mailing list
> Devl at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://emu.freenetproject.org/pipermail/devl/attachments/20071218/e005d7c9/attachment.pgp 


More information about the Devl mailing list