Software /
code /
prosody
Comparison
util/human/units.lua @ 12802:4a8740e01813
Merge 0.12->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 12 Dec 2022 07:10:54 +0100 |
parent | 12589:39ae08180c81 |
comparison
equal
deleted
inserted
replaced
12801:ebd6b4d8bf04 | 12802:4a8740e01813 |
---|---|
2 local math_ceil = math.ceil; | 2 local math_ceil = math.ceil; |
3 local math_floor = math.floor; | 3 local math_floor = math.floor; |
4 local math_log = math.log; | 4 local math_log = math.log; |
5 local math_max = math.max; | 5 local math_max = math.max; |
6 local math_min = math.min; | 6 local math_min = math.min; |
7 local unpack = table.unpack or unpack; --luacheck: ignore 113 | 7 local unpack = table.unpack; |
8 | |
9 if math_log(10, 10) ~= 1 then | |
10 -- Lua 5.1 COMPAT | |
11 local log10 = math.log10; | |
12 function math_log(n, base) | |
13 return log10(n) / log10(base); | |
14 end | |
15 end | |
16 | 8 |
17 local large = { | 9 local large = { |
18 "k", 1000, | 10 "k", 1000, |
19 "M", 1000000, | 11 "M", 1000000, |
20 "G", 1000000000, | 12 "G", 1000000000, |