import math


def round_to_interval(value, interval):
    """Round a number to a given interval."""
    return round(
        round(value / interval + 0.5) * interval, -int(math.floor(math.log10(interval)))
    )