Can someoneword, or explain the mathematical aspect happening in this part of the Number Conversion script? thank you
math.floor(p1/(10^((v2-1)*3)/100))/100 … u1[v2]
Conversion Script:
local u1 = {"", 'K', "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "Oc", "No", "Dc"}
function v1(p1)
for v2 = 1, #u1 do
if tonumber(p1) < 10 ^ (v2*3) then
return math.floor(p1/(10^((v2-1)*3)/100))/100 .. u1[v2]
end
end
end
Well, let’s say the number is 100. The v2 number would be 1.
here
we subtract 1 from it, so we get 0.
multiply it by 3, it would still be 0
By order of operations, we then do the exponential part (10^0), which is 1.
Next, we will divide by 100 and get 0.01
lastly, we do 100/0.01, which leads to 10000 and do math.floor to remove any decimals
Divide by 100, and you get 100 again.
Lastly, add the correct prefix.
This is the best way I can explain it, which is just the simple process of solving the equation with substitution on knowing what the numbers would be, but I hope this helps!