*
* $Id$
*
* $Log$
* Revision 1.1  1996/02/15 17:48:16  mclareni
* Initial revision
*
*
#include "kernnum/pilot.h"
      DOUBLE PRECISION FUNCTION DFREQ(DX)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
#if defined(CERNLIB_NUMOWNCODE)
      EXTERNAL DERF,DERFC
#endif
C
      DATA CONST/ 0.70710 67811 86548 D0 /
C     ( CONST=SQRT(1/2). )
C
#if defined(CERNLIB_NUME2465)
      DATA XMAX/ 75.3 D0 /
#endif
#if defined(CERNLIB_NUME293)
      DATA XMAX/ 25.8 D0 /
#endif
#if defined(CERNLIB_NUME75)
      DATA XMAX/ 13.0 D0 /
#endif
#if defined(CERNLIB_NUME38)
      DATA XMAX/ 8.9 D0 /
#endif
#if defined(CERNLIB_NUME999)
      DATA XMAX/ *** NOT AVAILABLE *** /
#endif
C     ( XMAX=SQRT(-ALOG(RMIN)-10.0), WHERE RMIN IS THE SMALLEST NORMAL-
C     IZED REPRESENTABLE NUMBER.  ERFC(XMAX) IS CLOSE TO THE UNDERFLOW
C     THRESHOLD. )
C
C     ******************************************************************
C
C  START.
      CX=CONST*DBLE(DX)
      IF(CX.LT.-XMAX) THEN
         DFREQ=0.D0
      ELSE
         IF(CX.GE.0.D0) DFREQ = 0.5D0 + 0.5D0*DERF(CX)
         IF(CX.LT.0.D0) DFREQ = 0.5D0*DERFC(-CX)
      ENDIF
      RETURN
      END
