def METHOD_NAME(x: float) -> float:
    log_base = 10 ** (math.floor(math.log10(x)))
    log_factor = x / log_base
    if log_factor >= 5:
        return 5 * log_base
    return 2 * log_base if log_factor >= 2 else log_base