title: Why do I have to specify implicitly for a double precision return value of a function in Fortran?
body: <p>I am new to Fortran and I am trying on the <code>common</code> block. My code is simple</p>
  
  <pre><code>program main
      implicit double precision (p)
      real * 8 :: x, y
      common /yvalue/ y
      x = 3d0
      y = 3d0
      print *, power(x)
  end program main
  
  function power(x)
      implicit none
      real * 8 :: power
      real * 8 :: x, y
      common /yvalue/ y
      power = x ** y
  end function power
  </code></pre>
  
  <p>It works but if I comment out the second line, which implicitly declares variables starting with <code>p</code> to be double precision, the compiler complains the following</p>
  
  <pre class="lang-sh prettyprint-override"><code>Error: Return type mismatch of function ‘power’ at (1) (REAL(4)/REAL(8))
  </code></pre>
  
  <p>I do get the point that the return value <code>power</code> is by default a single precision variable, but why declaring <code>power</code> as double precision in the function is not enough? And why writing <code>real * 8 power</code> in <code>main</code> would not work either?</p>