Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Inconsistent math behavior on ifort 11.1

$
0
0

HI All!

          I'm compiling the code below in gfortan, ifort 11.1 and ifort 14.0.3.

PROGRAM TEST
  REAL :: x, x2(5), z
  COMPLEX :: y, y2(5)
  z = -1.
  z=sqrt(z)
  x=5./z
  x2=5./z
  y = (1.,1.)*x
  y2= (1.,1.)*x2
  WRITE(*,*) x
  WRITE(*,*) x2
  WRITE(*,*) y
  WRITE(*,*) y2
  WRITE(*,*) x /= x
  WRITE(*,*) ANY(x2 /= x2)
  WRITE(*,*) y /= y
  WRITE(*,*) ANY(y2 /= y2)
END PROGRAM TEST

 

     The problem is when ifort 11.1 compares an array of NaNs with another array of NaNs, it returns false instead of true. Is it a compiler bug? Is there a way to set ifort 11.1 in a way it outputs the same results as in ifort 14.3?

 

$ gfortran -V

gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)

$ ./teste_gfortran
             NaN
             NaN             NaN             NaN             NaN             NaN
 (            NaN,            NaN)
 (            NaN,            NaN) (            NaN,            NaN) (            NaN,            NaN) (            NaN,            NaN) (            NaN,            NaN)
 T
 T
 T
 T

 

$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler Professional for applications running on Intel(R) 64, Version 11.1    Build 20090827 Package ID: l_cprof_p_11.1.056
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

$ ./teste_ifort_11_1
 NaN
 NaN            NaN            NaN            NaN            NaN
 (NaN,NaN)
 (NaN,NaN) (NaN,NaN) (NaN,NaN) (NaN,NaN) (NaN,NaN)
 T
 T
 F
 F

 

 

$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.3.174 Build 20140422
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

t$ ./teste_ifort_14_03
            NaN
            NaN            NaN            NaN            NaN            NaN
 (NaN,NaN)
 (NaN,NaN) (NaN,NaN) (NaN,NaN) (NaN,NaN) (NaN,NaN)
 T
 T
 T
 T

 

 

 

 

 


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>