from typing import Union
import math


def truncate_to_block(length: Union[int, float], block_size: int) -> int:
    """
    Rounds the given length to the nearest (smaller) multiple of
    the block size.
    """
    return int(math.floor(length / block_size)) * block_size