[tor-dev] tor's definition of 'median'

nusenu nusenu at openmailbox.org
Mon Aug 10 17:11:52 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

https://gitweb.torproject.org/torspec.git/tree/dir-spec.txt#n2028

> If 3 or more authorities provide a Measured= keyword for a router,
> the authorities produce a consensus containing a "w" Bandwidth=
> keyword equal to the median of the Measured= votes.

a random sample from recent votes:

grep 37.59.38.117 -A 3 *|grep Measured
w Bandwidth=6869 Measured=7570
w Bandwidth=6869 Measured=15500
w Bandwidth=6869 Measured=18100
w Bandwidth=6869 Measured=30500

Tor says the median value is
15500

2015-08-10-16-00-00-consensus:
w Bandwidth=15500

but the median of these 4 values is actually:
(18100+15500)/2 = 16800
no?

Has tor a different definition of 'median' and simply takes always the
second ordered measurement vote out of 4 votes or is there a bug in
the spec or implementation?
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJVyNtYAAoJEFv7XvVCELh0YU8P/0hWhCLfafvFDPdAfUwUJFPA
A1ZA946JGKg1Vjy+ch3tffjDHRosXt7K5U33N9rKMUlW9ul2BQ+uNgzK4eTbghHz
yCMn6D+uLk1xruYTsIUZ+Pk/ZywaUKj/FngohVvQnaJIgJCHCEnCIqqBNEK0PjUh
EBzI5GdyWpEA2fh55PSRuSNCVzbiVhGwYSKgrVwFrFcKr9iPLmdZsa9SD1mb1PD1
IZOkU6TnSnFGbPaN+pHYdNr5/QJA1/08yYBpG7qAJaTCAMvMif7bKMJ7ElYo7opc
oXcECIcBBPnATgKvbO47dbSnX3s+vPMsrRhhdTa1BMr1MIzVG3RWGhNSJwXXQTJh
jyaPGj10JRWNxDsY0ro001MX0HymmXeLLCkY4nWsUqPXDiZcQe4oRzLQas5bOI94
ct4tCavj9pRNp2XYCWe631gqcsQ3xV7y37dWUCvpdXqt2NC1B7j2w/Y/UiuNArSj
QBtS4Ap5wqnU5JySjndi+lIPOlaPk9uitmzpKLxNF9fnpI6ZECP3T50vHVeZiiQ9
7o1ZyBsPLk3bi2hRy8ZJ0wyO+5WF8bdrlsKXSR40UjrwQZ5kCQf6xmWiSg9PqZFU
rIL14yCOsQkR3P4/IgMlL8dtgFk3Asmkkx039144fRKveEhffFjo54CUMhg/jLra
EF5cUqz4QdgcpRvKa/5h
=lA/6
-----END PGP SIGNATURE-----


More information about the tor-dev mailing list