Fix a horribly shameful bug computing a modulo on floats

This commit is contained in:
Tissevert 2019-04-14 19:49:19 +02:00
parent 2d9cfd818d
commit e1f338f1f1

View file

@ -56,7 +56,7 @@ scheduleByMedicine pharmacy day medicineName stockLeft rate =
where where
(Medicine {minStock, content}) = pharmacy ! medicineName (Medicine {minStock, content}) = pharmacy ! medicineName
truncateF = fromInteger . truncate truncateF = fromInteger . truncate
leftInBox = content - (truncateF (content / stockLeft) * stockLeft) leftInBox = stockLeft - (truncateF (stockLeft / content) * content)
typeAndAmount :: Float -> Float -> Float -> (ScheduleType, Float) typeAndAmount :: Float -> Float -> Float -> (ScheduleType, Float)
typeAndAmount stockLeft minStock leftInBox = typeAndAmount stockLeft minStock leftInBox =