Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/Map-range/ALGOL-68/map-range.alg
Normal file
9
Task/Map-range/ALGOL-68/map-range.alg
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# maps a real s in the range [ a1, a2 ] to the range [ b1, b2 ] #
|
||||
# there are no checks that s is in the range or that the ranges are valid #
|
||||
PROC map range = ( REAL s, a1, a2, b1, b2 )REAL:
|
||||
b1 + ( ( s - a1 ) * ( b2 - b1 ) ) / ( a2 - a1 );
|
||||
|
||||
# test the mapping #
|
||||
FOR i FROM 0 TO 10 DO
|
||||
print( ( whole( i, -2 ), " maps to ", fixed( map range( i, 0, 10, -1, 0 ), -8, 2 ), newline ) )
|
||||
OD
|
||||
Loading…
Add table
Add a link
Reference in a new issue