Join GitHub today
PERCENTILE(value,0) does not work, returns null instead of MIN value #4418
percentile(value,0) is just returning null while min(value) is returning a value
referenced this issue
Jan 5, 2016
changed the title
[0.9.4] PERCENTILE(value,0) does not work, returns null instead of MIN value
May 17, 2016
It looks like we have an off-by-one problem with every percentile. Wolfram alpha tells me the 50th percentile of a 10 value slice should be the 5th value (4th index) (here) and it tells me the 51st percentile should be the 6th value (5th index) (here).
This ends up applying to the 0th percentile because it gets told it should access the 0th value (-1th index) and we exit if we get an invalid value like that. It looks like it's due to how the rounding and floor are being done. The rounding appears to be that it should round down on 0.5 rather than up and we currently always take the floor rather than attempting to round.
I'm going to double check this since I'm not the most familiar with percentiles.