Active object: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(Added ATS before →‎{{header|BASIC}})
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(One intermediate revision by one other user not shown)
Line 331:
 
val integral = integral + ((sample_last + sample_now)
* clock2f (t_last - t_now))
* g0f2f 0.5)
val sample_last = sample_now
val t_last = t_now
Line 444 ⟶ 445:
One will get different results on different runs.
<pre>$ patscc -std=gnu2x -Ofast active_object_task.dats -lm && ./a.out
integrator output = -0.000017000002</pre>
 
=={{header|BASIC}}==
Line 3,761 ⟶ 3,762:
 
What I've done instead is to pre-compute the number of updates performed on my machine for a given function and time period which is a fairly stable figure (though it will obviously be different on other machines). I've then used this figure to measure elapsed time for each update. On average this gives results of around 0.003 seconds which I consider acceptable in the circumstances.
<syntaxhighlight lang="ecmascriptwren">import "scheduler" for Scheduler
import "timer" for Timer
 
9,485

edits