Anonymous user
Module:Convert: Difference between revisions
builtin hand units default to show name not symbol since "h" is "hour" and is uncommon for "hand"
(Theodore O'Connor was a {{hands|14.1+3/4}} pony means 14 hands + 1.75 inches = 57.75 inches (although module rounds that to 57.8 by default)) |
(builtin hand units default to show name not symbol since "h" is "hour" and is uncommon for "hand") |
||
Line 694:
-- [[mile]]s per [[United States customary units|U.S.]] [[quart]]
-- [[long ton]]s per [[short ton]]
-- Assume that links cannot be nested (never like "[[abc[[def]]ghi]]").
-- This uses a simple and efficient procedure that works for most cases.
-- Some units (if used) would require more, and can later think about
Line 1,833:
-- Input info.clean uses en digits (it has been translated, if necessary).
-- Output show uses en or non-en digits as appropriate, or can be spelled.
local invalue, inclean
if info then
invalue, inclean = info.value, info.clean
Line 1,848:
-- precision if the output uses scientific notation (very large, or very
-- small). Not worth more complexity as these cases should be very rare.
if parms.abbr_org == nil then
out_current.usename = true -- default is to show name not symbol
local dummy_unit_table = { scale = out_current.scale }
local success, outinfo = cvtround(parms, info, in_current, dummy_unit_table)
Line 1,877 ⟶ 1,880:
inches = inches:sub(1, 1) .. inches:sub(3)
end
return
▲ show = outinfo.sign .. with_separator(parms, format('%d', hands)) .. numdot .. from_en(inches)
▲ }
end
local outvalue, extra = convert(invalue, inclean, in_current, out_current)
Line 1,898:
outvalue = -outvalue
end
local success, use_default_precision, show, exponent
local precision = parms.precision
if not precision then
Line 1,935:
end
end
if (show == '1' or show:match('^1%.0*$') ~= nil) and not isnegative then▼
-- Use match because on some systems 0.99999999999999999 is 1.0.▼
end
local t = format_number(parms, show, exponent, isnegative)
t.raw_absvalue = outvalue -- absolute value before rounding
t.use_default_precision = use_default_precision
|