Skip to content

Commit

Permalink
Relax duration math
Browse files Browse the repository at this point in the history
  • Loading branch information
levinericzimmermann committed Nov 5, 2022
1 parent dafdf6c commit 2ae8591
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mutwo/core_parameters/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ class Duration(
def _math_operation(
self, other: DurationOrReal, operation: typing.Callable[[float, float], float]
) -> Duration:
if isinstance(other, core_constants.Real.__args__):
other = core_parameters.DirectDuration(float(other))
self.duration = fractions.Fraction(operation(self.duration, other.duration))
self.duration = fractions.Fraction(
operation(self.duration, getattr(other, "duration", other))
)
return self

@core_utilities.add_copy_option
Expand Down

0 comments on commit 2ae8591

Please sign in to comment.