      program minmax
************************************************************************
*     (Minimum/Maximum of NaN)
*     Fortran program to test the handling of IEEE 754 NaN by the
*     min() and max() intrinsic functions.
*     (30-Nov-2001)
************************************************************************
      real NaN

      NaN = store(0.0)
      NaN = NaN/store(NaN)

      call test(1.0, 2.0)
      call test(1.0, NaN)
      call test(NaN, 1.0)
      call test(NaN, NaN)

      end

      real function store(x)
      real x
      store = x
      return
      end

      subroutine test(x,y)
      real x, y

      write (6,1000) 'max', x, y, max(x,y)
      write (6,1000) 'min', x, y, min(x,y)
 1000 format (a,'(', f15.2, ',', f15.2, ') ->', f15.2)

      end
