def query(rank)
      flush

      current = @head
      return unless current

      mid_rank = (rank * @observations).floor
      max_rank = mid_rank + (invariant(mid_rank, @observations) / 2).floor

      rank = 0.0
      while current.successor
        rank += current.rank
        if rank + current.successor.rank + current.successor.delta > max_rank
          return current.value
        end

        current = current.successor
      end

      return current.value
    end
def query(rank)
      flush

      current = @head
      return unless current

      mid_rank = (rank * @observations).floor
      max_rank = mid_rank + (invariant(mid_rank, @observations) / 2).floor

      rank = 0.0
      while current.successor
        rank += current.rank
        if rank + current.successor.rank + current.successor.delta > max_rank
          return current.value
        end

        current = current.successor
      end

      return current.value
    end
Get a quantile value for a given rank.

 @param rank [Float] The target quantile to retrieve.  It *must* be one of
                     the invariants provided in the constructor.

 @return [Numeric, nil]  The quantile value for the rank or nil if no
   observations are present.