import math


def closest_pow(ref: float, base: float, force_next: bool = False) -> float:
    """
    Computes the closest power of base based on a given reference.

    :param float ref:       Reference
    :param float base:      Exponential base
    :param bool force_next: If reference is equal to power of base, forces next power.

    :return: Closest power.
    :rtype: float
    """
    aux = round(math.log(ref, base))
    val = base ** aux
    if (val < ref) or (force_next and (val == ref)):
        val = base ** (aux + 1)
    return val