title: Can I call the fortran log function with a number?
body: <p>I'm getting some strange results from the log function in gfortran 4.5 (OSX) and gfortran 4.7 (OSX). </p>
  
  <p>The following program gives the unexpected results:</p>
  
  <pre><code>program test_log
    real(8) :: e = 2.7182818284590451_8
    write(*,*) 'log(2.7..)', log(2.7182818284590451_8)
    write(*,*) 'log(e)', log(e)
  end program test_log
  </code></pre>
  
  <p>I run it like this:</p>
  
  <pre><code>gfortran-mp-4.5 ./test.f90  &amp;&amp; ./a.out 
  log(2.7..)   1.6249753165355076     
  log(e)   1.0000000000000000
  </code></pre>
  
  <p>I expected both to be 1.0</p>
  
  <p><em>Update:</em></p>
  
  <pre><code>program test_log
    real(8) :: e = 2.7182818284590451_8
    real(8) :: e2 = 2.7182818284590451D0
    real(8) :: e3 = exp(1.0)
    write(*,*) 'log(2.7..)', log(2.7182818284590451_8)
    write(*,*) 'log(e)', log(e)
    write(*,*) 'log(e2)', log(e2)
    write(*,*) 'log(e3)', log(e3)
  end program test_log
  </code></pre>
  
  <p>gives</p>
  
  <pre><code>gfortran-mp-4.5 ./test.f90  &amp;&amp; ./a.out 
   log(2.7..)   1.6249753165355076     
   log(e)   1.0000000000000000     
   log(e2)   1.0000000000000000     
   log(e3)   1.0188423211430429
  </code></pre>