Unexpected NaN value

Thomas Koenig tkoenig@netcologne.de
Thu Oct 4 20:30:00 GMT 2018


Hi Luca,

> program test
>      implicit none
> 
>      real :: a = -1.57079637
>      real :: b = 2.1
> 
>      write(*,*) cos(a)
>      write(*,*) cos(a) **(2*b)
> 
> end program

cos(a) happens to be negative, so cos(a)**(2*b) is undefined,
because 2*b is real.  And yes, this is expected.

Regards

	Thomas



More information about the Fortran mailing list