import math


def logistic_decay(d: float, a: float):
    """
    Logistic decay is a smooth version of the window decay.

    f(d) = 1 - 1 / (1 + exp(-d + a)) = exp(-d + a) / (1 + exp(-d + a))

    :param d: distance (non-negative finite value)
    :param a: the x-value of the sigmoid's midpoint
    :return: decay
    """
    return math.exp(-d + a) / (1 + math.exp(-d + a))