Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Map-range/Bc/map-range.bc
Normal file
16
Task/Map-range/Bc/map-range.bc
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* map s from [a, b] to [c, d] */
|
||||
define m(a, b, c, d, s) {
|
||||
return (c + (s - a) * (d - c) / (b - a))
|
||||
}
|
||||
|
||||
scale = 6 /* division to 6 decimal places */
|
||||
"[0, 10] => [-1, 0]
|
||||
"
|
||||
for (i = 0; i <= 10; i += 2) {
|
||||
/*
|
||||
* If your bc(1) has a print statement, you can try
|
||||
* print i, " => ", m(0, 10, -1, 0, i), "\n"
|
||||
*/
|
||||
i; " => "; m(0, 10, -1, 0, i)
|
||||
}
|
||||
quit
|
||||
Loading…
Add table
Add a link
Reference in a new issue