Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Map-range/REXX/map-range-1.rexx
Normal file
11
Task/Map-range/REXX/map-range-1.rexx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*REXX program maps and displays a range of numbers from one range to another range.*/
|
||||
rangeA = 0 10 /*or: rangeA = ' 0 10 ' */
|
||||
rangeB = -1 0 /*or: rangeB = " -1 0 " */
|
||||
parse var rangeA L H
|
||||
inc= 1
|
||||
do j=L to H by inc * (1 - 2 * sign(H<L) ) /*BY: either +inc or -inc */
|
||||
say right(j, 9) ' maps to ' mapR(rangeA, rangeB, j)
|
||||
end /*j*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
mapR: procedure; parse arg a1 a2,b1 b2,s;$=b1+(s-a1)*(b2-b1)/(a2-a1);return left('',$>=0)$
|
||||
11
Task/Map-range/REXX/map-range-2.rexx
Normal file
11
Task/Map-range/REXX/map-range-2.rexx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*REXX program maps and displays a range of numbers from one range to another range.*/
|
||||
rangeA = 10 0 /*or: rangeA = ' 0 10 ' */
|
||||
rangeB = -1 0 /*or: rangeB = " -1 0 " */
|
||||
parse var rangeA L H
|
||||
inc= 1/2
|
||||
do j=L to H by inc * (1 - 2 * sign(H<L) ) /*BY: either +inc or -inc */
|
||||
say right(j, 9) ' maps to ' mapR(rangeA, rangeB, j)
|
||||
end /*j*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
mapR: procedure; parse arg a1 a2,b1 b2,s;$=b1+(s-a1)*(b2-b1)/(a2-a1);return left('',$>=0)$
|
||||
13
Task/Map-range/REXX/map-range-3.rexx
Normal file
13
Task/Map-range/REXX/map-range-3.rexx
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/*REXX program maps and displays a range of numbers from one range to another range.*/
|
||||
rangeA = 0 10
|
||||
rangeB = -1 0
|
||||
inc = 1
|
||||
call mapR rangeA, rangeB, inc
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
mapR: procedure; parse arg a1 a2, b1 b2, inc /* [↓] BY is either +inc or -inc.*/
|
||||
do s=a1 to a2 by inc * (1 - 2 * sign(a2 < a1) )
|
||||
t= b1 + (s-a1) * (b2-b1) / (a2-a1)
|
||||
say right(s, 9) ' maps to' left('', t>=0) t
|
||||
end /*s*/
|
||||
return /* [↑] LEFT··· aligns non─negative #'s*/
|
||||
10
Task/Map-range/REXX/map-range-4.rexx
Normal file
10
Task/Map-range/REXX/map-range-4.rexx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/*REXX program maps a number from one range to another range. */
|
||||
/* 31.10.2013 Walter Pachl */
|
||||
/* 'translated' from an older version 1 without using Procedure */
|
||||
do j=0 to 10
|
||||
say right(j,3) ' maps to ' mapRange(0,10,-1,0,j)
|
||||
end
|
||||
exit
|
||||
/*──────────────────────────────────MAPRANGE subroutine─────────────────*/
|
||||
mapRange: return arg(3)+(arg(5)-arg(1))*(arg(4)-arg(3))/(arg(2)-arg(1))
|
||||
/* Arguments are arg a1,a2,b1,b2,x */
|
||||
Loading…
Add table
Add a link
Reference in a new issue