datasketch/b_bit_minhash.py
def _calc_a(self, r, b):
        '''
        Compute the function A(r, b)
        '''
        if r == 0.0:
            # Find the limit of A(r, b) as r -> 0.
            return 1.0 / (1 << b)
        return r * (1 - r) ** (2 ** b - 1) / (1 - (1 - r) ** (2 * b))
def _calc_a(self, r, b):
        '''
        Compute the function A(r, b)
        '''
        if r == 0.0:
            # Find the limit of A(r, b) as r -> 0.
            return 1.0 / (1 << b)
        return r * (1 - r) ** (2 ** b - 1) / (1 - (1 - r) ** (2 * b))
Compute the function A(r, b)