From e1f338f1f195c67fe75745dd2878decd60cc09fc Mon Sep 17 00:00:00 2001 From: Tissevert Date: Sun, 14 Apr 2019 19:49:19 +0200 Subject: [PATCH] Fix a horribly shameful bug computing a modulo on floats --- src/Schedule.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Schedule.hs b/src/Schedule.hs index 84d6879..9a64ebc 100644 --- a/src/Schedule.hs +++ b/src/Schedule.hs @@ -56,7 +56,7 @@ scheduleByMedicine pharmacy day medicineName stockLeft rate = where (Medicine {minStock, content}) = pharmacy ! medicineName truncateF = fromInteger . truncate - leftInBox = content - (truncateF (content / stockLeft) * stockLeft) + leftInBox = stockLeft - (truncateF (stockLeft / content) * content) typeAndAmount :: Float -> Float -> Float -> (ScheduleType, Float) typeAndAmount stockLeft minStock leftInBox =