espnet2.samplers.category_balanced_sampler.round_down
Less than 1 minute
espnet2.samplers.category_balanced_sampler.round_down
espnet2.samplers.category_balanced_sampler.round_down(num, divisor)
Round down a number to the nearest multiple of a specified divisor.
This function takes a number and reduces it to the nearest lower multiple of the given divisor. This is particularly useful in scenarios where you need to ensure that a quantity is evenly divisible by another.
- Parameters:
- num (int or float) – The number to be rounded down.
- divisor (int or float) – The divisor to which the number should be rounded down.
- Returns: The largest integer or float less than or equal to num that is divisible by divisor.
- Return type: int or float
Examples
>>> round_down(10, 3)
9
>>> round_down(10.5, 2)
10.0
>>> round_down(15, 5)
15
NOTE
If the divisor is zero, this function will raise a ZeroDivisionError.