Module:Coordinates: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 398: Line 398:


function convert_dec2dms_d(coordinate)
function convert_dec2dms_d(coordinate)
local d = math.floor( coordinate + 0.5 ) .. "°"
local d = math_mod._round( coordinate ) .. "°"
return d .. ""
return d .. ""
end
end
Line 405: Line 405:
-- {{#expr:{{{1}}} mod 360}}°{{padleft:{{#expr:({{{1}}} * 600 round 0) mod 600 / 10 round 0}}|2|0}}′
-- {{#expr:{{{1}}} mod 360}}°{{padleft:{{#expr:({{{1}}} * 600 round 0) mod 600 / 10 round 0}}|2|0}}′
local d = math.floor(coordinate % 360) .."°"
local d = math.floor(coordinate % 360) .."°"
local m = string.format( "%02d′", math.floor( math.floor(coordinate * 600 + 0.5) % 600 / 10 + 0.5) )
local m = string.format( "%02d′", math_mod._round( math_mod._round(coordinate * 600) % 600 / 10 ) )
return d .. m
return d .. m