Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
27
Task/Active-object/FreeBASIC/active-object.basic
Normal file
27
Task/Active-object/FreeBASIC/active-object.basic
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#define twopi 6.2831853071795864769252867665590057684
|
||||
dim shared as double S = 0 'set up the state as a global variable
|
||||
dim shared as double t0, t1, ta
|
||||
|
||||
function sine( x as double, f as double ) as double
|
||||
return sin(twopi*f*x)
|
||||
end function
|
||||
|
||||
function zero( x as double, f as double ) as double
|
||||
return 0
|
||||
end function
|
||||
|
||||
sub integrate( K as function(as double, as double) as double, f as double )
|
||||
'represent input as pointers to functions
|
||||
t1 = timer
|
||||
s += (K(t1,f) + K(t0,f))*(t1-t0)/2.0
|
||||
t0 = t1
|
||||
end sub
|
||||
|
||||
t0 = timer
|
||||
ta = timer
|
||||
|
||||
while timer-ta <= 2.5
|
||||
if timer-ta <= 2 then integrate( @sine, 0.5 ) else integrate( @zero, 0 )
|
||||
wend
|
||||
|
||||
print S
|
||||
Loading…
Add table
Add a link
Reference in a new issue