Skip to main content
1 of 3
george2079
  • 39.1k
  • 1
  • 44
  • 111

lets make a fair fortran test... raise a complex typed number 1 to the power:

   write(*,*)(-1.d0,0.d0)**2.,(-1.d0,0.d0)**2

(1.00000000000,-2.449212707...E-16 ) , ( 1.0000000000,0.000000000 )

also note in fortran the real power can not yield a complex result, that is -1.**.5 throws an error or yields NaN depending on the compiler so you see -1**2. works only because (/if) the compiler is smart enough to recognize that 2. should be treated as an integer.

george2079
  • 39.1k
  • 1
  • 44
  • 111