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

Sebastian Hahn sebastian at torproject.org
Thu Aug 13 19:06:42 UTC 2015


> On 13 Aug 2015, at 18:50, Nick Mathewson <nickm at alum.mit.edu> wrote:
> 
> On Wed, Aug 12, 2015 at 5:34 PM, nusenu <nusenu at openmailbox.org> wrote:
>> from today's measurement meeting:
>> 
>>> 15:00:20 <virgil> karsten: I've decided I'm going to fix the definition of median
>>> 15:00:26 <virgil> in the tor sourcecode
>>> 15:00:36 <karsten> virgil: is it broken?
>>> 15:00:53 <karsten> or just not specified as clearly as it should be?
>>> 15:01:01 <virgil> for ordered list {a,b,c,d}, it returns b instead of (b+c)/2.
>>> 15:01:24 <karsten> yes. maybe that's for a reason (which I don't know).
>>> 15:01:40 <virgil> I look forward to hearing this reason when my patch is rejected.
>>> 15:01:41 <karsten> like, using value (b+c)/2 would break for some reason, whereas any of a, b, c, d would be fine.
>>> 15:01:45 <Sebastian> you cannot do that
>>> 15:01:51 <Sebastian> without breaking Tor's voting
>>> 15:02:21 <Sebastian> Tor's specification requires low median for a bunch of directory stuff
>> 
>> 
>> I'd be interested in the reason as well.
> 
> The correct fix here is to update the code documentation to define the
> functions as returning the low-median, and to update dir-spec.txt to
> say so too.  I'd accept documentation patches like that.

The documentation for the code already says that. The spec could be
updated to say low-median consistently, tho.

Cheers
Sebastian


More information about the tor-dev mailing list