      implicit none

      real*8 x,y,z,v,r,s

      v = 1.d0
      y = 0.d0

      r  = 1.d0
      s  = 1.d0

      z = DSQRT(r) - DSQRT(s)
      z = DABS(z)

      x=y/z

      write(*,*) ' '

      write(*,'(a)') 'COMPUTED VALUE     CORRECT VALUE'

      write(*,*) ' '
      write(*,'(a,f9.6,a)') ' x = ', x, '       x =     NaN'
      write(*,'(a,f9.6,a)') ' v = ', v, '       v = 1.00000'
      write(*,*) ' '

      write(*,*) ' (x.eq.v) =', (x.eq.v), '	(x.eq.v) =  F' 
      write(*,*) ' (x.lt.v) =', (x.lt.v), '	(x.lt.v) =  F' 
      write(*,*) ' (x.le.v) =', (x.le.v), '	(x.le.v) =  F'
      write(*,*) ' (x.gt.v) =', (x.gt.v), '	(x.gt.v) =  F' 
      write(*,*) ' (x.ge.v) =', (x.ge.v), '	(x.ge.v) =  F' 
      write(*,*) ' (x.ne.v) =', (x.ne.v), '	(x.ne.v) =  T' 
      write(*,*) ' '
      write(*,*) ' (x.eq.x) =', (x.eq.x), '	(x.eq.x) =  F' 
      write(*,*) ' (x.lt.x) =', (x.lt.x), '	(x.lt.x) =  F' 
      write(*,*) ' (x.le.x) =', (x.le.x), '	(x.le.x) =  F' 
      write(*,*) ' (x.gt.x) =', (x.gt.x), '	(x.gt.x) =  F' 
      write(*,*) ' (x.ge.x) =', (x.ge.x), '	(x.ge.x) =  F' 
      write(*,*) ' (x.ne.x) =', (x.ne.x), '	(x.ne.x) =  T' 

      x=-x

      write(*,*) ' '
      write(*,'(a,f9.6,a)') ' x = ', x, '       x =    -NaN'
      write(*,'(a,f9.6,a)') ' v = ', v, '       v = 1.00000'
      write(*,*) ' '

      write(*,*) ' (x.eq.v) =', (x.eq.v), '	(x.eq.v) =  F' 
      write(*,*) ' (x.lt.v) =', (x.lt.v), '	(x.lt.v) =  F' 
      write(*,*) ' (x.le.v) =', (x.le.v), '	(x.le.v) =  F'
      write(*,*) ' (x.gt.v) =', (x.gt.v), '	(x.gt.v) =  F' 
      write(*,*) ' (x.ge.v) =', (x.ge.v), '	(x.ge.v) =  F' 
      write(*,*) ' (x.ne.v) =', (x.ne.v), '	(x.ne.v) =  T' 
      write(*,*) ' '
      write(*,*) ' (x.eq.x) =', (x.eq.x), '	(x.eq.x) =  F' 
      write(*,*) ' (x.lt.x) =', (x.lt.x), '	(x.lt.x) =  F' 
      write(*,*) ' (x.le.x) =', (x.le.x), '	(x.le.x) =  F' 
      write(*,*) ' (x.gt.x) =', (x.gt.x), '	(x.gt.x) =  F' 
      write(*,*) ' (x.ge.x) =', (x.ge.x), '	(x.ge.x) =  F' 
      write(*,*) ' (x.ne.x) =', (x.ne.x), '	(x.ne.x) =  T' 

      write(*,*) ' '

      end
