From 3198e9b88b3b59979556dc6088ec9f539b4041cd Mon Sep 17 00:00:00 2001 From: Ian Day Date: Sun, 30 Apr 2023 20:53:57 -0400 Subject: [PATCH] feat: fix rounding fix rounding error to only show even number of plates --- src/which_plates/functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/which_plates/functions.py b/src/which_plates/functions.py index ac67ef5..21e9370 100644 --- a/src/which_plates/functions.py +++ b/src/which_plates/functions.py @@ -41,7 +41,7 @@ def calc_plates(weight: int, available_plates: list[float]) -> dict: # at least two plates left in remaining weight if remaining_weight / Decimal(plate) >= Decimal(2): # can only use even number of plates - if ((remaining_weight / Decimal(plate)) % 2) == 0: + if (int(remaining_weight / Decimal(plate)) % 2) == 0: plate_count = int(Decimal(remaining_weight) // Decimal(plate)) else: plate_count = int(Decimal(remaining_weight) // Decimal(plate)) - 1