BreakoutDetection icon indicating copy to clipboard operation
BreakoutDetection copied to clipboard

Potentail bug while calculating approxmiate median

Open utkrist opened this issue 8 years ago • 0 comments

Line 65 of this file edmTail.cpp contains the following line return lWeight*(quant*(lu-l)+l) + rWeight*(quant*(u-rl)+rl); where

lu = (u+l)/2;
rl = (u+lu)/2;

This seems wrong. Shouldn't this be: return lWeight*(quant*(lu-l)+l) + rWeight * (quant*(u-lu)+lu);

Simple visulization of the problem: say we have the line return lWeight * ML + rWeight * MR; The current implementation is returning the first case while it should be the second case.

l.....................ML..................... lu ......................rl.............MR.............u

l.....................ML.................... lu ......................MR..........................u

utkrist avatar Jul 10 '16 15:07 utkrist