Program example
  Use quad1
  Implicit None
  Integer,Parameter :: wp = Selected_Real_Kind(15)
  Real(wp) res,true
  Double Precision secs
  Real(wp),Parameter :: a = 1.0_wp, b = 10.0_wp
  Integer,Parameter :: steps = 1000*1000*1000
  Integer(Selected_Int_Kind(18)) t1,t2,irate
  Call System_Clock(Count_Rate=irate)
  Call System_Clock(t1)
  Call rectangle_rule(f,a,b,steps,res)
  Call System_Clock(t2)
  Print *,'Calculated value:   ',res
  true = 1 - 0.1d0
  Print *,'True value (approx):',true
  Print *,'Relative error',Abs((res-true)/true)
  secs = (t2-t1)/Dble(irate)
  If (secs>=0.1d0) Then
    Print 1,secs,'seconds'
  Else 
    Print 1,secs*1000,'milliseconds'
  End If
1 Format(1X,'Time taken ',F0.3,1X,A)
Contains
  Real(wp) Function f(x)
    Real(wp),Intent(In) :: x
    f = 1/x**2
  End Function
End Program
