calculate median according to its definition
Merge pull request #43 from RIPE-NCC/fixmedian

calculate median according to its definition