def percentile(self, p):
        if not (0 <= p <= 100):
            raise ValueError("p must be between 0 and 100, inclusive.")

        t = 0
        p = float(p)/100.
        p *= self.n

        for i, key in enumerate(self.C.keys()):
            c_i = self.C[key]
            k = c_i.count
            if p < t + k:
                if i == 0:
                    return c_i.mean
                elif i == len(self) - 1:
                    return c_i.mean
                else:
                    delta = (self.C.succ_item(key)[1].mean - self.C.prev_item(key)[1].mean) / 2.
                return c_i.mean + ((p - t) / k - 0.5) * delta

            t += k
        return self.C.max_item()[1].mean
tangents to the ellipse
dataset/ETHPy150Open CamDavidsonPilon/tdigest/tdigest/tdigest.py/TDigest.percentile--crossover with--dataset/ETHPy150Open mkenworthy/exorings/exorings.py/ellipse_tangents