Misc: Use the ^ operator instead of math.pow (#9550)

And some minor code simplifications, thanks to @zwim ;).
This commit is contained in:
NiLuJe
2022-09-28 01:11:34 +02:00
committed by GitHub
parent 62059f8d68
commit 4d48b6e2fe
4 changed files with 15 additions and 17 deletions

View File

@@ -33,7 +33,7 @@ local logger = require("logger")
local function get_dpi_scale()
local size_scale = math.min(Screen:getWidth(), Screen:getHeight()) / 600
local dpi_scale = Screen:scaleByDPI(1)
return math.pow(2, math.max(0, math.log((size_scale+dpi_scale)/2)/0.69))
return math.max(0, (math.log((size_scale+dpi_scale)/2)/0.69)^2)
end
local DPI_SCALE = get_dpi_scale()