2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,11 +1,11 @@
/*REXX program maps a range of numbers from one range to another range. */
rangeA = 0 10 /*or: rangeA = ' 0 10 ' */
rangeB = -1 0 /*or: rangeB = " -1 0 " */
/*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: +inc │ -inc) */
say right(j,digits()) ' maps to ' mapRange(rangeA,rangeB,j)
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)
end /*j*/
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────MAPRANGE subroutine─────────────────*/
mapRange: procedure; arg a1 a2,b1 b2,s; return b1+ (s-a1)*(b2-b1)/(a2-a1)
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)

View file

@ -1,11 +1,11 @@
/*REXX pgm maps a range of numbers from one range to another with inc=½.*/
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: +inc │ -inc) */
say right(j,9) ' maps to ' mapRange(rangeA,rangeB,j)
/*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)
end /*j*/
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────MAPRANGE subroutine─────────────────*/
mapRange: procedure; arg a1 a2,b1 b2,s; return b1+ (s-a1)*(b2-b1)/(a2-a1)
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)

View file

@ -1,12 +1,12 @@
/*REXX program maps a range of numbers from one range to another range. */
/*REXX program maps and displays a range of numbers from one range to another range.*/
rangeA = 0 10
rangeB = -1 0
inc=1
inc = 1
call mapRange rangeA, RangeB, inc
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────MAPRANGE subroutine─────────────────*/
mapRange: procedure; parse a1 a2, b1 b2, inc
do s=a1 to a2 by inc*(1-2*sign(a2<a1)) /*BY: +inc │ -inc */
say right(s,digits()) ' maps to ' b1+(s-a1)*(b2-b1)/(a2-a1)
end /*s*/ /*↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑*/
return /*════════════t════════════*/
exit /*stick a fork in it, we're 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═══════════════*/