X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/eabec5f434225aa68aa33565d8cf5055f287662e..b6912d6d22b3c6fc635e602412bdb83884630a38:/luatz/timetable.lua diff --git a/luatz/timetable.lua b/luatz/timetable.lua index e2930d8..0dbf4c8 100644 --- a/luatz/timetable.lua +++ b/luatz/timetable.lua @@ -76,8 +76,8 @@ local function carry ( tens , units , base ) tens = tens + idiv ( units , base ) units = units % base elseif units < 0 then - tens = tens - 1 + idiv ( -units , base ) - units = base - ( -units % base ) + tens = tens + idiv ( units , base ) + units = ( base + units ) % base end return tens , units end