June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,11 +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
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, digits()) ' maps to ' mapRange(rangeA, rangeB, j)
say right(j, 9) ' maps to ' mapR(rangeA, rangeB, j)
end /*j*/
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
mapRange: procedure; parse arg a1 a2,b1 b2,s; return b1 + (s-a1) * (b2-b1) / (a2-a1)
mapR: procedure; parse arg a1 a2,b1 b2,s;$=b1+(s-a1)*(b2-b1)/(a2-a1);return left('',$>=0)$

View file

@ -1,11 +1,11 @@
/*REXX program maps and displays a range of numbers from one range to another range.*/
rangeA = 10 0 /*or: rangeA = ' 10 0 ' */
rangeB = -1 0 /*or: rangeB = " -1 0 " */
parse var RangeA L H /*note the LOW & HIGH values in A*/
inc= 1/2 /*use a different step size (inc)*/
do j=L to H by inc * (1 - 2 * sign(H<L) ) /*BY: either +inc or -inc */
say right(j, digits()) ' maps to ' mapRange(rangeA, rangeB, j)
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.*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
mapRange: procedure; parse arg a1 a2,b1 b2,s; return b1 + (s-a1) * (b2-b1) / (a2-a1)
mapR: procedure; parse arg a1 a2,b1 b2,s;$=b1+(s-a1)*(b2-b1)/(a2-a1);return left('',$>=0)$

View file

@ -1,12 +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 mapRange rangeA, RangeB, inc
exit /*stick a fork in it, we're done.*/
rangeA = 0 10
rangeB = -1 0
inc = 1
call mapR rangeA, rangeB, inc
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
mapRange: procedure; parse arg a1 a2, b1 b2, inc /* [↓] BY: either +inc or -inc*/
do s=a1 to a2 by inc * (1 - 2 * sign(a2 < a1) )
say right(s,digits()) ' maps to ' b1 + (s-a1) * (b2-b1) / (a2-a1)
end /*s*/ /*↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑*/
return /*═══════════════t═══════════════*/
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*/

View file

@ -1,6 +1,6 @@
/*REXX program maps a number from one range to another range. */
/* 31.10.2013 Walter Pachl */
/* 'translated' from version 1 without using Procedure */
/* '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