Replace math.pow by ^

This commit is contained in:
Lars Mueller 2020-12-19 15:31:37 +01:00
parent 2f01c5716b
commit 826c7b7aae
4 changed files with 5 additions and 5 deletions

@ -153,7 +153,7 @@ function generate_settingtypes(default_conf, constraints)
local range = constraints.range
if range then
-- TODO consider better max
type_args = (constraints.int and "%d %d" or "%f %f"):format(range[1], range[2] or math.pow(2, 30))
type_args = (constraints.int and "%d %d" or "%f %f"):format(range[1], range[2] or 2 ^ 30)
end
-- HACK
if not default_conf then default_conf = range[1] end

@ -39,7 +39,7 @@ function tostring(number, base, digit_function, precision)
number = number % 1
if number ~= 0 and number >= base ^ -precision then
table.insert(out, ".")
while precision >= 0 and number >= math.pow(base, precision) do
while precision >= 0 and number >= base ^ precision do
number = number * base
digit = math.floor(number % base)
table.insert(out, digit_function(digit))

@ -1,4 +1,4 @@
max_wear = math.pow(2, 16) - 1
max_wear = 2 ^ 16 - 1
function override(function_name, function_builder)
local func = minetest[function_name]
minetest["original_" .. function_name] = func

@ -120,9 +120,9 @@ function utf8(number)
result = string.char(128 + remainder) .. result
number = (number - remainder) / 64
i = i + 1
if number <= math.pow(2, 8 - i - 2) then break end
if number <= 2 ^ (8 - i - 2) then break end
end
return string.char(256 - math.pow(2, 8 - i - 1) + number) .. result
return string.char(256 - 2 ^ (8 - i - 1) + number) .. result
end
--+ deprecated