This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View file

@ -0,0 +1,12 @@
/*REXX program maps a number from one range to another range. */
rangeA = '0 10'
rangeB = '-1 0'
do j=0 to 10
say right(j,3) ' maps to ' mapRange(rangeA, rangeB, j)
end /*j*/
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────MAPRANGE subroutine─────────────────*/
mapRange: procedure; arg a1 a2,b1 b2,x; return b1+(x-a1)*(b2-b1)/(a2-a1)

View file

@ -0,0 +1,9 @@
/*REXX program maps a number from one range to another range. */
do j=0 to 10
say right(j,3) ' maps to ' mapRange(0 10, -1 0, j)
end /*j*/
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────MAPRANGE subroutine─────────────────*/
mapRange: procedure; arg a1 a2,b1 b2,x; return b1+(x-a1)*(b2-b1)/(a2-a1)

View file

@ -0,0 +1,9 @@
/*REXX program maps a number from one range to another range. */
rangeA = '0 10'; parse var rangeA a1 a2
rangeB = '-1 0'; parse var rangeB b1 b2
do j=0 to 10
say right(j,3) ' maps to ' b1+(x-a1)*(b2-b1)/(a2-a1)
end /*j*/
/*stick a fork in it, we're done.*/