Skip to content

Commit 4bd9993

Browse files
christoph-heinrichpo5
authored andcommitted
Round values in timer target speed check
math.floor() can result in one value being off by 1 because one was just barely below the whole integer while the other one was not. (floating point numbers \o/) Adding 0.5 for actual rounding avoids that problem. Closes #9
1 parent e0e50d7 commit 4bd9993

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

evafast.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ local function adjust_speed()
237237
end
238238
end
239239

240-
if math.floor(target_speed * 1000) == math.floor(current_speed * 1000) then
240+
if math.floor(target_speed * 1000 + 0.5) == math.floor(current_speed * 1000 + 0.5) then
241241
if forced_slowdown or (not toggled and (not speedup or options.subs_speed_cap == options.speed_cap or (not has_subtitle and not speedup_target))) then
242242
speed_timer:kill()
243243
toggled_display = true

0 commit comments

Comments
 (0)