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

Two-argument version of ATAN does not detect invalid complex argument

Harald1
New Contributor II
596 Views

Hello,

the following invalid code is accepted and gives "surprising" results at runtime:

program ifort_atan
  implicit none
  complex :: c = 1.
  print *, atan (-c,  c)
  print *, atan (-c,  c*2)
  print *, atan (-c*2,c*2)
! print *, atan2(-c,c)      ! <- this is diagnosed with ifort/ifx
end

 At runtime we get:

 (-0.7853982,0.0000000E+00)
 (-0.7853982,0.0000000E+00)
 (-1.107149,0.0000000E+00)

Apparently the second argument is silently dropped.  This can be verified by changing the type of c from complex to real.

Expected: a diagnostic similar to the one for atan2, which is identical to atan for 2 arguments.

 

1 Solution
taehunkim
Employee
270 Views

This issue was resolved in oneAPI 2025.0.

Thanks.

View solution in original post

0 Kudos
3 Replies
Barbara_P_Intel
Employee
550 Views

That one's dangerous! Wrong answers! I filed a bug report, CMPLRLLVM-57429.



0 Kudos
taehunkim
Employee
271 Views

This issue was resolved in oneAPI 2025.0.

Thanks.

0 Kudos
Harald1
New Contributor II
222 Views

Fixed indeed!

Thanks,

Harald

 

0 Kudos
Reply