summaryrefslogtreecommitdiffstats
path: root/tests/source/cosinus.scade
blob: a1596c2c83456fb6b31c10d4c86b7c93398a2b18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

const dt: real = 0.1;

node integrator(first: real; v: real; dt: real) returns (probe i: real)
let
  i = (first -> pre i) + (dt * v);
tel

node test(i: int) returns (a, b, c: int; exit: bool)
var
  probe cos, probe cosprime: real;
let
  cosprime = integrator(1.0, 0. -> pre (-cos), dt);
  cos = integrator(0., cosprime, dt);
  a = int(cos * 1000.);
  b = int(cosprime * 1000.);
  c = int(-cos * 1000.);
  exit = (i > 8000);
tel