Jump to content

Module:NumberAbbr: Difference between revisions

MisterChuChu (talk | contribs)
Add minus to abbr tag title
MisterChuChu (talk | contribs)
No edit summary
Line 6: Line 6:
local s=f.args[3]~=nil and math.max(f.args[3],3) or 6 --start at 10^
local s=f.args[3]~=nil and math.max(f.args[3],3) or 6 --start at 10^
local abt=f.args[4]==nil and false or f.args[4] --use abbr tag?
local abt=f.args[4]==nil and false or f.args[4] --use abbr tag?
local ps=f.args[5]==nil and false or f.args[5] --add plus symbol to positive numbers?
local chk=string.gsub(n,",","") --remove commas
local chk=string.gsub(n,",","") --remove commas
Line 58: Line 59:
end
end
m=m>0 and "-" or ""
m=m>0 and "-" or chk~="0" and ps and "+" or ""
return (math.log10(n2)>=3 and ep>=s) and (abt and "<abbr title=\""..m..n.."\">" or "")..m..nn..""..(not isinf and p.illion({args={math.floor(ep/3-1)}}) or "")..(abt and "</abbr>" or "") or nb
return ep>=s and (abt and "<abbr title=\""..m..n.."\">" or "")..m..nn..""..(not isinf and p.illion({args={math.floor(ep/3-1)}}) or "")..(abt and "</abbr>" or "") or m..n
end
end
end
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.