@% = 5 : REM Column width DIM range{l, h} DIM A{} = range{}, B{} = range{} A.l = 0 : A.h = 10 B.l = -1 : B.h = 0 FOR n = 0 TO 10 PRINT n " maps to " FNmaprange(A{}, B{}, n) NEXT END DEF FNmaprange(a{}, b{}, s) = b.l + (s - a.l) * (b.h - b.l) / (a.h - a.l)