A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
12
Task/Map-range/REXX/map-range-1.rexx
Normal file
12
Task/Map-range/REXX/map-range-1.rexx
Normal 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)
|
||||
9
Task/Map-range/REXX/map-range-2.rexx
Normal file
9
Task/Map-range/REXX/map-range-2.rexx
Normal 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)
|
||||
9
Task/Map-range/REXX/map-range-3.rexx
Normal file
9
Task/Map-range/REXX/map-range-3.rexx
Normal 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.*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue