multiple_of#

static Parse.multiple_of(value: float, factor: float, rounding: str) float[source]#

Rounds a value to a multiple of a given factor.

Parameters:
  • value (float) – Input value.

  • factor (float) – Factor that the value needs to be multiple of.

  • rounding (str) – Method of rounding (nearest, down).

Returns:

Rounded value.

Return type:

float

Changed in version 0.5.3: Invalid rounding value raises ValueError instead of RuntimeError.