Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29359 Discussions

Bug in IFX compiler with complex division

spainchaud
New Contributor I
209 Views

I am not sure where to report a bug. Please move this to the correct forum.

Here is my test code:

 

program DivisionTest

implicit none
COMPLEX*16 A, B, C

A = DCMPLX(-1.811004047684485D-316,7.977508024816439D-317)
B = DCMPLX(-5.220325499023662D-315,-1.310905257053363D-314)
C=A/B

print *, C

end program DivisionTest

 

With the IFX (both 2024 and 2035) compiler I get C=(NaN,NaN)

With the IFORT compiler I get C= (-5.041342791822924E-004,-1.401566961551338E-002).

 

This example is derived from a modeling code we have been using for 15+ years. With the move to IFX we noticed occasional bad values (NaN) in the output. For now, we will need to stick to IFORT.

0 Kudos
1 Solution
jdelia1
Beginner
163 Views

Dear  spainchaud,

Perhaps, try using:

ifx -error-limit 4 -e03 -fimf-arch-consistency=true -fimf-precision=high -finline-functions -fpp -ipo -mtune=generic -m64 -parallel-source-info=1 -std18 -O2 -fp-model consistent -warn all -o test-242-ifx.exe  -lpthread -ldl  test-242.f90

and with a light modified version

 program divisiontest
  implicit none
  complex (16) :: a, b, c
  !
  a = cmplx (-1.811004047684485d-316, 7.977508024816439d-317,kind=16)
  b = cmplx (-5.220325499023662d-315,-1.310905257053363d-314,kind=16)
  c = a/b
  print *, c
  !
end program divisiontest

It result:
 
$ test-242-ifx.exe 
 (-5.041342791822923141600437837173058E-0004, -1.401566961551337420031908227999678E-0002)

May be?
 
Regards,
Jorge D'Elia.

View solution in original post

0 Kudos
2 Replies
jdelia1
Beginner
164 Views

Dear  spainchaud,

Perhaps, try using:

ifx -error-limit 4 -e03 -fimf-arch-consistency=true -fimf-precision=high -finline-functions -fpp -ipo -mtune=generic -m64 -parallel-source-info=1 -std18 -O2 -fp-model consistent -warn all -o test-242-ifx.exe  -lpthread -ldl  test-242.f90

and with a light modified version

 program divisiontest
  implicit none
  complex (16) :: a, b, c
  !
  a = cmplx (-1.811004047684485d-316, 7.977508024816439d-317,kind=16)
  b = cmplx (-5.220325499023662d-315,-1.310905257053363d-314,kind=16)
  c = a/b
  print *, c
  !
end program divisiontest

It result:
 
$ test-242-ifx.exe 
 (-5.041342791822923141600437837173058E-0004, -1.401566961551337420031908227999678E-0002)

May be?
 
Regards,
Jorge D'Elia.
0 Kudos
spainchaud
New Contributor I
129 Views

All I had to change was COMPLEX*16 to COMPLEX(16) and I got the correct answer. No other changes or flags were needed. That should be much easier to fix in my code. Thanks.

0 Kudos
Reply