Python runtime: Money division should remain rational (#403)

This commit is contained in:
Denis Merigoux 2023-02-21 10:26:38 +01:00 committed by GitHub
commit 3c6b96970b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,7 +151,7 @@ class Money:
def __truediv__(self, other: 'Money') -> Decimal:
if isinstance(other, Money):
return Decimal(mpq(self.value.value / other.value.value))
return self.value / other.value
elif isinstance(other, Decimal):
return self * (1. / other.value)
else: