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

Matthew Toseland toad at amphibian.dyndns.org
Tue Dec 18 15:21:28 UTC 2007


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!
> 
> 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
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://emu.freenetproject.org/pipermail/devl/attachments/20071218/3012f38a/attachment.pgp 


More information about the Devl mailing list