Differences From
Artifact [3e36361725]:
20 20 end
21 21 local dsq = (d.x ^ 2) + (d.y ^ 2) + (d.z ^ 2)
22 22 return dsq / (dist^2)
23 23 -- [0,1) == less then
24 24 -- 1 == equal
25 25 -- >1 == greater than
26 26 end
27 +
28 +local unpack = table.unpack or unpack
27 29
28 30 -- produce an SI expression for a quantity
29 31 fn.si = function(unit, val, full, uncommonScales, prec)
30 32 if val == 0 then return '0 ' .. unit end
31 33 local scales = {
32 34 {30, 'Q', 'quetta',true, 'q', 'quecto',true};
33 35 {27, 'R', 'ronna', true, 'r', 'ronto', true};
................................................................................
51 53 end
52 54 end
53 55 return unit
54 56 end
55 57
56 58 for i, s in ipairs(scales) do
57 59 local amt, smaj, pmaj, cmaj,
58 - smin, pmin, cmin = lib.tbl.unpack(s)
60 + smin, pmin, cmin = unpack(s)
59 61
60 62
61 63 if math.abs(val) > 1 then
62 64 if uncommonScales or cmaj then
63 65 local denom = 10^amt
64 66 local vd = val/denom
65 67 if prec then vd = lib.math.trim(vd, prec) end