RosettaCodeData/Task/Map-range/Ring/map-range.ring

14 lines
221 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
# Project : Map range
2018-06-22 20:57:24 +00:00
decimals(1)
2017-09-23 10:01:46 +02:00
al = 0
ah = 10
bl = -1
bh = 0
for n = 0 to 10
2018-06-22 20:57:24 +00:00
see "" + n + " maps to " + maprange(al, bl, n) + nl
2017-09-23 10:01:46 +02:00
next
func maprange(al, bl, s)
2018-06-22 20:57:24 +00:00
return bl + (s - al) * (bh - bl) / (ah - al)