      real*8 function dhav( x )
!
!     Haversine function: hav(x) = (1-cos(x))/2.
!
!     B. Knapp, 96.01.29
!
C
C     RCS DATA
C     
C     $Header$
C     
C     $Log$
C
C
      implicit none
!
      real*8 x
!
!     Use numerically stable identity:
      dhav = sin(x/2.d0)**2
      return
      end
