real(fp) FUNCTION frantic_zh3x(zxx)
  use iso_c_binding, only: fp => c_double
  use physconst_mod, only: zero, one, two
  implicit none
  ! Argument variables:
  real(fp), intent(in) :: zxx
  ! Local variables
  real(fp), parameter :: zpio2 = 1.570796327_fp
  !
  !  AVOID UNDERFLOW ON VAX-- FCN VALUE SET TO ZERO if ZXX .GT. 77
  !  CORRESPONDING TO A FCN VALUE OF ABOUT 1.E-34
  !
  if(ZXX.LE.TWO) then
    frantic_zh3x=EXP(-ZXX)*ZEEE1(ZXX)
  else if(ZXX.LE.77.0_fp) then
    frantic_zh3x=EXP(-ZXX)*ZEEE2(ONE/ZXX)
  else
    frantic_zh3x=ZERO
  end if
  !
  return

contains

  !
  !  STATEMENT FCNS
  !
  real(fp) function zeee1(y)
    real(fp), intent(in) :: y
    zeee1 =  ZPIO2 - Y*(0.4292037_fp - Y*(0.3561945_fp - Y*(0.462238_fp - &
         Y*(0.404604_fp - Y*(0.178267_fp - Y*0.030169_fp)))))
    return
  end function zeee1

  real(fp) function zeee2(y)
    real(fp), intent(in) :: y
    zeee2 = SQRT(Y)*(2.50663_fp - Y*(4.18947_fp - Y*(13.9212_fp - &
         Y*(46.3264_fp - Y*(92.7633_fp-Y*73.3359_fp)))))
    return
  end function zeee2

end FUNCTION frantic_zh3x
