' map range
for i = 0 to 10
print using("##.#", i); " maps to ";
print using("##.#", mapRange(i, 0, 10, -1, 0))
next i
end
function mapRange(s, a1, a2, b1, b2)
mapRange = b1 + (s - a1) * (b2 - b1) / (a2 - a1)
end function