Module:Sandbox/Andy M. Wang/Sandbox/sandbox: Difference between revisions

Content deleted Content added
again
checking again
Line 8:
function p.speed_of_sound(frame)
local altitude = tonumber(frame.args[1]) -- args[0] is speed_of_sound
local mach_table = { -- ascale =
799.5, 787.0, 774.2, 761.207051, -- -3 to 0
748.0, 734.6, 721.0, 707.0, 692.8, 678.3, 663.5, 660.1, 660.1, 660.1, -- 1 to 10
Line 18:
}
altitude = altitude or 0
a = math.max(-3,- math.min(60,divide math.floor((altitude /and 5000)add +a fudge factor ((altitudecomplication <of 0) andbefore -0.5we orfloor 0.5))))it
-- ensure it is within range [-3..60]
return mach_table[a + 4] * 0.44704 .. ' | ' .. a .. ' | ' .. sign .. ' | ' .. altitude -- mph converted to m/s
scale = math.max(-3, math.min(60,
math.floor((altitude / 5000) + ((altitude < 0) and -0.5 or 0.5))))
return mach_table[ascale + 4] * 0.44704 .. ' | ' .. a .. ' | ' .. sign .. ' | ' .. altitude -- mph converted to m/s
end