Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Map-range/Seed7/map-range.seed7
Normal file
15
Task/Map-range/Seed7/map-range.seed7
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "float.s7i";
|
||||
|
||||
const func float: mapRange (in float: a1, in float: a2, in float: b1, in float: b2, ref float: s) is
|
||||
return b1 + (s-a1)*(b2-b1)/(a2-a1);
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var integer: number is 0;
|
||||
begin
|
||||
writeln("Mapping [0,10] to [-1,0] at intervals of 1:");
|
||||
for number range 0 to 10 do
|
||||
writeln("f(" <& number <& ") = " <& mapRange(0.0, 10.0, -1.0, 0.0, flt(number)) digits 1);
|
||||
end for;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue