<div dir="ltr">Is there some implementation-specific reason not to use the standard mathematical definition of "median"?  If not, I propose changing the implementation to become it.<div><br></div><div>-V</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 11, 2015 at 2:44 AM Nick Mathewson <<a href="mailto:nickm@alum.mit.edu">nickm@alum.mit.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Aug 10, 2015 at 1:11 PM, nusenu <<a href="mailto:nusenu@openmailbox.org" target="_blank">nusenu@openmailbox.org</a>> wrote:<br>
> -----BEGIN PGP SIGNED MESSAGE-----<br>
> Hash: SHA512<br>
><br>
> Hi,<br>
><br>
> <a href="https://gitweb.torproject.org/torspec.git/tree/dir-spec.txt#n2028" rel="noreferrer" target="_blank">https://gitweb.torproject.org/torspec.git/tree/dir-spec.txt#n2028</a><br>
><br>
>> If 3 or more authorities provide a Measured= keyword for a router,<br>
>> the authorities produce a consensus containing a "w" Bandwidth=<br>
>> keyword equal to the median of the Measured= votes.<br>
><br>
> a random sample from recent votes:<br>
><br>
> grep 37.59.38.117 -A 3 *|grep Measured<br>
> w Bandwidth=6869 Measured=7570<br>
> w Bandwidth=6869 Measured=15500<br>
> w Bandwidth=6869 Measured=18100<br>
> w Bandwidth=6869 Measured=30500<br>
><br>
> Tor says the median value is<br>
> 15500<br>
><br>
> 2015-08-10-16-00-00-consensus:<br>
> w Bandwidth=15500<br>
><br>
> but the median of these 4 values is actually:<br>
> (18100+15500)/2 = 16800<br>
> no?<br>
><br>
> Has tor a different definition of 'median' and simply takes always the<br>
> second ordered measurement vote out of 4 votes or is there a bug in<br>
> the spec or implementation?<br>
<br>
There's one misplaced throwaway sentence in dir-spec.txt:<br>
<br>
"  All ties in computing medians are broken in favor of the smaller or<br>
   earlier item.<br>
"<br>
<br>
We should bring this, and probably other things, into a "definitions"<br>
section earlier in dir-spec.txt.  Patches welcome. ;)<br>
<br>
--<br>
Nick<br>
_______________________________________________<br>
tor-dev mailing list<br>
<a href="mailto:tor-dev@lists.torproject.org" target="_blank">tor-dev@lists.torproject.org</a><br>
<a href="https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev" rel="noreferrer" target="_blank">https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev</a><br>
</blockquote></div>