title: Infinity in Fortran
body: <p>What is the safest way to set a variable to +Infinity in Fortran? At the moment I am using:        </p>
  
  <pre><code>program test
    implicit none
    print *,infinity()
  contains
    real function infinity()
      implicit none
      real :: x
      x = huge(1.)
      infinity = x + x
    end function infinity
  end program test
  </code></pre>
  
  <p>but I am wondering if there is a better way?</p>