def binomial_coefficient(n_, k_):
    """
    Computes the coefficient of the x k-term in the polynomial expansion of the binomial power (1 + x) n
    Appropriately corrects for special cases, unlike the numpy implementation

    Parameters:
    ----------
    n: int
    k:int

    Returns:
    -------
    Binomial Coefficient.
    """
    n = float(n_)
    k = float(k_)
    if (n == -1 and k > 0):
        return -1.0 ** k
    if (n == -1 and k < 0):
        return (-1.0 ** k) * -1.0
    if (n == -1 and k == 0):
        return 1.0
    if (n == k):
        return 1.0
    if n >= k:
        if k > n - k:  # take advantage of symmetry
            k = n - k
        c = 1
        for i in range(int(k)):
            c = c * (n - i)
            c = c // (i + 1)
        return float(c)
    else:
        return 0.0