langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
20
Task/Map-range/NetRexx/map-range.netrexx
Normal file
20
Task/Map-range/NetRexx/map-range.netrexx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref savelog symbols nobinary
|
||||
|
||||
A = [ 0.0, 10.0 ]
|
||||
B = [ -1.0, 0.0 ]
|
||||
incr = 1.0
|
||||
|
||||
say 'Mapping ['A[0]',' A[1]'] to ['B[0]',' B[1]'] in increments of' incr':'
|
||||
loop sVal = A[0] to A[1] by incr
|
||||
say ' f('sVal.format(3, 3)') =' mapRange(A, B, sVal).format(4, 3)
|
||||
end sVal
|
||||
|
||||
return
|
||||
|
||||
method mapRange(a = Rexx[], b = Rexx[], s_) public static
|
||||
return mapRange(a[0], a[1], b[0], b[1], s_)
|
||||
|
||||
method mapRange(a1, a2, b1, b2, s_) public static
|
||||
t_ = b1 + ((s_ - a1) * (b2 - b1) / (a2 - a1))
|
||||
return t_
|
||||
Loading…
Add table
Add a link
Reference in a new issue