0010 FUNC integral(REF f(),a,b) CLOSED
0020   n:=16; dx:=(b-a)/n
0030   xi:=a; s:=(f(a)-f(b))*dx/6
0040   FOR i:=1 TO n DO xi:=xi+dx; s:=s+(f(xi)+2*f(xi-dx/2))*dx/3
0050   RETURN s
0060 ENDFUNC integral
0070
0080 FUNC errf(x) CLOSED
0090   FUNC g(x)
0100     RETURN exp(-x*x/2)
0110   ENDFUNC g
0120   IMPORT integral(,,)
0130   RETURN integral(g(),0,x)/sqr(2*pi)+0.5
0140 ENDFUNC errf
0150
0160 FOR x:=-1 TO 1 STEP 0.1 DO PRINT errf(x)
